Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the link to LoicMahieu/aor-tinymce-input (or explicit that it's broken on v3) #4264

Closed
Rowern opened this issue Jan 8, 2020 · 1 comment · Fixed by #4274
Closed

Comments

@Rowern
Copy link

Rowern commented Jan 8, 2020

Is your feature request related to a problem? Please describe.
The linked package doesn't work anymore with v3.

Describe the solution you'd like
We created this simple component to use TinyMCE.
If you think it is good enough we can create a package for it (or maybe put it inside the doc).

It does rely on the lodash debounce otherwise the change are too frequent and the input becomes laggy as hell.

import React, { useState } from 'react';
import { useForm } from 'react-final-form';
import { Editor } from '@tinymce/tinymce-react';
import * as _ from 'lodash';

const TinyMCEInput = ({ source, ...props }: { source: string }) => {
  const form = useForm();
  const firstInit = _.get(form.getState().initialValues, source, '');
  const [init] = useState(firstInit);

  const debouncedOnChange = _.debounce(text => {
    form.change(source, text);
  }, 500);
  return (
    <Editor
      init={{
        plugins: ['autoresize', 'lists link '],
        menubar: false,
        statusbar: false,
        toolbar:
          'undo redo | bold italic underline strikethrough | forecolor | link | removeformat ',
      }}
      initialValue={init}
      onEditorChange={content => {
        debouncedOnChange(content);
      }}
    />
  );
};

export default TinyMCEInput;

It might be a really bad way to do it, if you have any suggestion I'm all ears.

PS: Your tool is incredible! Thanks to the dev team!

@Luwangel
Copy link
Contributor

Hi, thanks :) We worked a lot to release this v3 and we're glad you enjoy it.

I'll update the documentation by removing your package from the 3.x versions.

If you want help to upgrade your module, you could post your questions it inside the React Admin channel on StackOverflow.

Regards,
Adrien

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants