React/Preact compatibility cleanup

This commit is contained in:
Rainer Simon 2021-06-11 12:03:44 +02:00
parent 7faceb41e4
commit a9046c8dfb
11 changed files with 13 additions and 15 deletions

View File

@ -1,4 +1,4 @@
import React from 'preact/compat';
import React from 'react';
/**
* Icon from IcoFont https://icofont.com/, licensed under the CC BY 4.0 license.

View File

@ -1,5 +1,4 @@
import React from 'preact/compat';
import { useState, useRef, useEffect } from 'preact/hooks';
import React, { useState, useRef, useEffect } from 'react';
import { getWidget, DEFAULT_WIDGETS } from './widgets';
import { TrashIcon } from '../Icons';
import setPosition from './setPosition';

View File

@ -1,4 +1,4 @@
import { useEffect } from 'preact/hooks';
import { useEffect } from 'react';
export default function useClickOutside(ref, callback) {

View File

@ -1,4 +1,4 @@
import React, { Component } from 'preact/compat';
import React, { Component } from 'react';
export default class WrappedWidget extends Component {

View File

@ -1,5 +1,4 @@
import React from 'preact/compat';
import { useState } from 'preact/hooks';
import React, { useState } from 'react';
import TimeAgo from 'timeago-react';
import DropdownMenu from './DropdownMenu';
import TextEntryField from './TextEntryField';

View File

@ -1,4 +1,4 @@
import React from 'preact/compat';
import React from 'react';
import Comment from './Comment';
import TextEntryField from './TextEntryField';
import i18n from '../../../i18n';

View File

@ -1,5 +1,4 @@
import React from 'preact/compat';
import { useRef } from 'preact/hooks';
import React, { useRef } from 'react';
import useClickOutside from '../../useClickOutside';
import i18n from '../../../i18n';

View File

@ -1,4 +1,4 @@
import React from 'preact/compat';
import React from 'react';
import Select from 'react-select';
export const PURPOSES = [

View File

@ -1,4 +1,4 @@
import React, { Component } from 'preact/compat';
import React, { Component } from 'react';
import TextareaAutosize from 'react-autosize-textarea';
import i18n from '../../../i18n';

View File

@ -1,14 +1,16 @@
import React from 'react';
import ReactDOM from 'react-dom';
import CommentWidget from './comment/CommentWidget'
import TagWidget from './tag/TagWidget';
import WrappedWidget from './WrappedWidget';
/**
* We'll add React to the global window, so that
* We'll add React and ReactDOM to the global window, so that
* plugins can use it without re-bundling. Also,
* without this, hooks won't work!
*/
window.React = React;
window.ReactDOM = ReactDOM;
/** Standard widgets included by default **/
const BUILTIN_WIDGETS = {

View File

@ -1,5 +1,4 @@
import React from 'preact/compat';
import { useState } from 'preact/hooks';
import React, { useState } from 'react';
import { CSSTransition } from 'react-transition-group';
import { CloseIcon } from '../../../Icons';
import i18n from '../../../i18n';