Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
}
this._deferredRender();
const options = this.options;
if ($(this.$el).prop('disabled') || $(this.$el).prop('readonly')) {
options.readonly = true;
}
_.each(this.options.pluginsMap, function(url, name) {
url = location.origin + '/' + this.options.assets_base_url + url;
if (this.options.plugins.indexOf(name) !== -1) {
tinyMCE.PluginManager.load(name, url);
}
}, this);
tinyMCE.init(_.extend({
target: this.el,
setup: function(editor) {
editor.on('keydown', function(e) {
if (e.keyCode === 27) {
_.defer(function() {
// action is deferred to give time for tinymce to process the event by itself first
self.$el.trigger(e);
});
}
});
editor.on('change', function() {
editor.save({no_events: true});
});
editor.on('SetContent', function() {
editor.save({no_events: true});
});
});
$('.sidebar').animate({ scrollTop: sidebarScrolPosition }, 0);
// This is a workaround to handle the SPA nature of turbolinks
window.BookableRangeReady = true;
$(document).trigger('bookablerange.ready');
// Persist page scroll position
if (Turbolinks.scroll.top) {
document.documentElement.scrollTop = Turbolinks.scroll.top;
Turbolinks.scroll = {};
}
// Initialize the tinymce
TinyMCE.init({
selector: '.tinymce',
skin_url: '/tinymce/ui/oxide',
plugins: "image imagetools",
toolbar: "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | outdent indent | image",
content_css: '/tinymce/ui/oxide/content.css'
});
// Initialize dropzone(s)
$('.dropzone').dropzone({
parallelUploads: 1,
init: function() {
this.on('queuecomplete', function(file) {
window.location = routes.route(
window.Accessarea + '.' + window.location.pathname.split('/')[2] + '.index'
);
});
export default function ({ selector }) {
tinymce.baseURL = '/static/tinymce'
const settings = JSON.parse(document.querySelector(selector).dataset.wysSettings)
settings.selector = selector
tinymce.init(settings)
}
mounted() {
tinymce.init({});
},
};
if ( store ) {
const state = store.getState();
localeSlug = getCurrentLocaleSlug( state );
isRtl = isLocaleRtl( localeSlug );
colorScheme = getPreference( state, 'colorScheme' );
}
this.localize( isRtl, localeSlug );
const ltrButton = isRtl ? 'ltr,' : '';
const gutenbergClassName = isGutenbergClassicBlock ? ' is-gutenberg' : '';
const spellchecker = isVipSite ? ',spellchecker' : '';
tinymce.init( {
selector: '#' + this._id,
skin_url: '/calypso/tinymce/skins/lightgray',
skin: 'lightgray',
content_css: CONTENT_CSS,
language: localeSlug,
language_url: DUMMY_LANG_URL,
directionality: isRtl ? 'rtl' : 'ltr',
formats: {
alignleft: [
{
selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li',
styles: { textAlign: 'left' },
},
{
selector: 'img,table,dl.wp-caption',
classes: 'alignleft',
init(options = {}) {
if (isObject(options)) {
tinymce.init($.extend(true, defaultOptions, options)).then(resizeEditors);
} else {
tinymce.init(defaultOptions).then(resizeEditors);
}
},
/*
auto_focus: autoFocus,
plugins: plugins || defaultPlugins,
readonly: isDisabled,
target: elementRef.current,
toolbar: toolbar || defaultToolbar,
setup: editor => {
editorRef.current = editor;
editor.on('init', () => {
if (typeof value === 'string') {
editor.setContent(value);
}
editor.on('change keyup setcontent', handleChange);
});
},
};
tinymce.init(options);
return () => {
tinymce.remove(editorRef.current);
};
}, [plugins, toolbar]);
componentDidMount() {
if (tinymce) {
tinymce.init({
selector: '.tinymce',
skin_url: '/skins/lightgray',
content_css: '/skins/raphael/content.css',
branding: false,
menubar: false,
plugins: 'code image link lists table',
toolbar:
'bold italic underline strikethrough subscript superscript blockquote removeformat | ' +
'bullist numlist | outdent indent | ' +
'alignleft aligncenter alignright alignjustify | ' +
'image link table | ' +
'styleselect formatselect | ' +
'code',
setup: editor => {
editor.on('change', () => {
this.props.onChange(editor.getContent());
};
const store = this.reduxStore;
let isRtl = false;
let localeSlug = 'en';
if ( store ) {
const state = store.getState();
localeSlug = getCurrentLocaleSlug( state );
isRtl = isLocaleRtl( localeSlug );
}
this.localize( isRtl, localeSlug );
tinymce.init( {
selector: '#' + this._id,
skin_url: '/calypso/tinymce/skins/lightgray',
skin: 'lightgray',
body_class: 'description',
content_css: '/calypso/tinymce/skins/woocommerce/content.css',
language: localeSlug,
language_url: this.DUMMY_LANG_URL,
directionality: isRtl ? 'rtl' : 'ltr',
relative_urls: false,
remove_script_host: false,
convert_urls: false,
browser_spellcheck: true,
fix_list_elements: true,
keep_styles: false,
textarea: this.textarea,
preview_styles: 'font-family font-size font-weight font-style text-decoration text-transform',
mounted() {
tinymce.init({})
},
methods: {