Replies: 11 comments
-
I guess base_url initialization option should work (try to add it to |
Beta Was this translation helpful? Give feedback.
-
I have similiar problem and from what I know editor looks for global variable |
Beta Was this translation helpful? Give feedback.
-
I tried just about everything and this ended up working for me:
I installed Hope this helps you and others! |
Beta Was this translation helpful? Give feedback.
-
@CAM603 check networking tab in dev tools. There is a possibility that tinymce still tries to load css files. In particular, it needs two |
Beta Was this translation helpful? Give feedback.
-
@GendelfLugansk okay, I do see a get request for |
Beta Was this translation helpful? Give feedback.
-
First of all, you will need to copy
Then you have two options:
|
Beta Was this translation helpful? Give feedback.
-
@GendelfLugansk That worked, thank you so much! |
Beta Was this translation helpful? Give feedback.
-
You can turn off the CSS requests in the config if you wish though generally if you can I'd advise loading from the public URL like GendelfLugansk says. If you wish to turn off the CSS requests and do everything with webpack you need something like this (this won't work with the more complex plugins): import { Editor } from '@tinymce/tinymce-react';
// TinyMCE so the global var exists
// eslint-disable-next-line no-unused-vars
import tinymce from 'tinymce/tinymce';
// Theme
import 'tinymce/themes/silver';
// Toolbar icons
import 'tinymce/icons/default';
// Editor styles
import 'tinymce/skins/ui/oxide/skin.min.css';
// importing the plugin js. Note that most of the premium plugins can't be imported this way because they have extra resources that have to be loaded asynchronously at runtime
import 'tinymce/plugins/advlist';
import 'tinymce/plugins/autolink';
import 'tinymce/plugins/link';
import 'tinymce/plugins/image';
import 'tinymce/plugins/lists';
import 'tinymce/plugins/charmap';
import 'tinymce/plugins/hr';
import 'tinymce/plugins/anchor';
import 'tinymce/plugins/spellchecker';
import 'tinymce/plugins/searchreplace';
import 'tinymce/plugins/wordcount';
import 'tinymce/plugins/code';
import 'tinymce/plugins/fullscreen';
import 'tinymce/plugins/insertdatetime';
import 'tinymce/plugins/media';
import 'tinymce/plugins/nonbreaking';
import 'tinymce/plugins/table';
import 'tinymce/plugins/template';
import 'tinymce/plugins/help';
// Content styles, including inline UI like fake cursors
/* eslint import/no-webpack-loader-syntax: off */
import contentCss from '!!raw-loader!tinymce/skins/content/default/content.min.css';
import contentUiCss from '!!raw-loader!tinymce/skins/ui/oxide/content.min.css';
export default function TinyEditorComponent(props) {
return (
<Editor
init={{
skin: false, // skin is loaded manually above as an import
content_css: false, // loaded manually directly below
content_style: [contentCss, contentUiCss].join('\n'),
/>
);
} |
Beta Was this translation helpful? Give feedback.
-
@tiny-james are you able to put a snippet in for the appropriate/required webpack rule to support the above- which will bundle the CSS in with the artifact? |
Beta Was this translation helpful? Give feedback.
-
Well if you're using raw-loader as above then you'll need to make a rule that only effects the two CSS files that need to be in the content. Working from the example on this page:
Though doing some googling it seems that the preferred method would be using css-loader combined with to-string-loader: So maybe something like:
|
Beta Was this translation helpful? Give feedback.
-
I'm going to convert this to a discussion as while it's useful it's not really an issue we can act on (except maybe to improve our docs). |
Beta Was this translation helpful? Give feedback.
-
Hi, the example works fine as that, without self-hosting.
However, when I tried selfhosting, the editor did not appear, though it seems to take same space.
What I did:
Installed with
npm install --save @tinymce/tinymce-react
Installed also with
npm install tinymce --save
I have following imports:
I also copied skins directory from node_modules to root (with src and also to src folder) from node_modules/tinymce/skins
However, the editor does not appear. I did not find a way to tell your Editor-component that tinyMCE is selfhosted, and not cloud version. Maybe that affects somehow, or I did something wrong there?
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions