Use TinyMCE as a module to avoid conflicts when used globally
This commit is contained in:
@ -1 +0,0 @@
|
||||
../../../node_modules/tinymce
|
@ -6,6 +6,16 @@
|
||||
import Marionette from 'backbone.marionette';
|
||||
import BehaviorsLookup from 'newsletter_editor/behaviors/BehaviorsLookup';
|
||||
import App from 'newsletter_editor/App';
|
||||
import tinymce from 'tinymce/tinymce';
|
||||
|
||||
// TinyMCE theme and plugins
|
||||
import 'tinymce/themes/modern';
|
||||
import 'tinymce/plugins/code';
|
||||
import 'tinymce/plugins/colorpicker';
|
||||
import 'tinymce/plugins/link';
|
||||
import 'tinymce/plugins/lists';
|
||||
import 'tinymce/plugins/paste';
|
||||
import 'tinymce/plugins/textcolor';
|
||||
|
||||
var BL = BehaviorsLookup;
|
||||
|
||||
@ -35,6 +45,8 @@ BL.TextEditorBehavior = Marionette.Behavior.extend({
|
||||
}
|
||||
|
||||
this.$(this.options.selector).tinymce(this.options.configurationFilter({
|
||||
tinymce.init(this.options.configurationFilter({
|
||||
target: this.el.querySelector(this.options.selector),
|
||||
inline: true,
|
||||
|
||||
menubar: false,
|
||||
|
@ -75,6 +75,7 @@
|
||||
"chai": "2.2.0",
|
||||
"chai-jq": "0.0.8",
|
||||
"clean-webpack-plugin": "^1.0.0",
|
||||
"copy-webpack-plugin": "^5.0.3",
|
||||
"cross-env": "^5.1.5",
|
||||
"eslint": "^5.15.3",
|
||||
"eslint-config-airbnb": "^17.1.0",
|
||||
|
@ -4,15 +4,19 @@ var sinonChai = require('sinon-chai');
|
||||
var chaiJq = require('chai-jq');
|
||||
var _ = require('underscore');
|
||||
var jsdom = require('jsdom/lib/old-api.js').jsdom;
|
||||
var URL = require('url').URL;
|
||||
|
||||
chai.use(sinonChai);
|
||||
chai.use(chaiJq);
|
||||
|
||||
global.expect = chai.expect;
|
||||
global.sinon = sinon;
|
||||
global.URL = URL;
|
||||
|
||||
if (!global.document || !global.window) {
|
||||
global.document = jsdom('<html><head><script></script></head><body></body></html>', {}, {
|
||||
global.document = jsdom('<html><head><script></script></head><body></body></html>', {
|
||||
url: 'http://example.com',
|
||||
}, {
|
||||
FetchExternalResources: ['script'],
|
||||
ProcessExternalResources: ['script'],
|
||||
MutationEvents: '2.0',
|
||||
|
@ -424,8 +424,6 @@
|
||||
|
||||
<% block after_javascript %>
|
||||
<%= javascript(
|
||||
'lib/tinymce/tinymce.min.js',
|
||||
'lib/tinymce/jquery.tinymce.min.js',
|
||||
'lib/mailpoet_shortcodes/plugin.js',
|
||||
'lib/wplink/plugin.js',
|
||||
'newsletter_editor.js'
|
||||
|
@ -2,6 +2,7 @@ const webpack = require('webpack');
|
||||
const webpackManifestPlugin = require('webpack-manifest-plugin');
|
||||
const webpackCleanPlugin = require('clean-webpack-plugin');
|
||||
const webpackTerserPlugin = require('terser-webpack-plugin');
|
||||
const webpackCopyPlugin = require('copy-webpack-plugin');
|
||||
const path = require('path');
|
||||
const globalPrefix = 'MailPoetLib';
|
||||
const PRODUCTION_ENV = process.env.NODE_ENV === 'production';
|
||||
@ -277,6 +278,16 @@ const adminConfig = {
|
||||
form_editor: 'form_editor/webpack_index.jsx',
|
||||
newsletter_editor: 'newsletter_editor/webpack_index.jsx',
|
||||
},
|
||||
plugins: [
|
||||
...baseConfig.plugins,
|
||||
|
||||
new webpackCopyPlugin([
|
||||
{
|
||||
from: 'node_modules/tinymce/skins/lightgray',
|
||||
to: 'skins/lightgray'
|
||||
},
|
||||
])
|
||||
],
|
||||
optimization: {
|
||||
runtimeChunk: {
|
||||
name: 'vendor',
|
||||
@ -315,7 +326,6 @@ const adminConfig = {
|
||||
},
|
||||
externals: {
|
||||
'jquery': 'jQuery',
|
||||
'tinymce': 'tinymce'
|
||||
}
|
||||
};
|
||||
|
||||
@ -414,7 +424,6 @@ const testConfig = {
|
||||
},
|
||||
externals: {
|
||||
'jquery': 'jQuery',
|
||||
'tinymce': 'tinymce',
|
||||
'interact': 'interact',
|
||||
'spectrum': 'spectrum',
|
||||
}
|
||||
|
Reference in New Issue
Block a user