Started upgrade to TinyMCE6, Untested

- Merged in latest TinyMCE code.
- Gone through tinymce upgrade guide, made required config changes.
- Altered license references.
This commit is contained in:
Dan Brown
2022-07-17 18:33:03 +01:00
parent d9e9c1735a
commit c519f707e8
85 changed files with 1228 additions and 2233 deletions

View File

@ -62,14 +62,12 @@ function file_picker_callback(callback, value, meta) {
/**
* @param {WysiwygConfigOptions} options
* @return {string}
* @return {string[]}
*/
function gatherPlugins(options) {
const plugins = [
"image",
"imagetools",
"table",
"paste",
"link",
"autolink",
"fullscreen",
@ -98,7 +96,7 @@ function gatherPlugins(options) {
plugins.push('drawio');
}
return plugins.filter(plugin => Boolean(plugin)).join(' ');
return plugins.filter(plugin => Boolean(plugin));
}
/**
@ -215,7 +213,7 @@ export function build(options) {
window.baseUrl('/dist/styles.css'),
],
branding: false,
skin: options.darkMode ? 'oxide-dark' : 'oxide',
skin: options.darkMode ? 'tinymce-5-dark' : 'tinymce-5',
body_class: 'page-content',
browser_spellcheck: true,
relative_urls: false,
@ -240,7 +238,6 @@ export function build(options) {
"+doc-root[code-block]"
].join(','),
plugins: gatherPlugins(options),
imagetools_toolbar: 'imageoptions',
contextmenu: false,
toolbar: getPrimaryToolbar(options),
content_style: getContentStyle(options),
@ -249,6 +246,8 @@ export function build(options) {
media_alt_source: false,
media_poster: false,
formats,
table_style_by_css: false,
table_use_colgroups: false,
file_picker_types: 'file image',
file_picker_callback,
paste_preprocess(plugin, args) {

View File

@ -132,9 +132,9 @@ function drop(editor, options, event) {
const range = editor.selection.getRng();
const selectedNodeRoot = selectedNode.closest('body > *');
if (range.startOffset > (range.startContainer.length / 2)) {
editor.$(selectedNodeRoot).after(draggedContentEditable);
editor.dom.select(selectedNodeRoot).after(draggedContentEditable);
} else {
editor.$(selectedNodeRoot).before(draggedContentEditable);
editor.dom.select(selectedNodeRoot).before(draggedContentEditable);
}
});
}

View File

@ -131,7 +131,7 @@ export function getPlugin(providedOptions) {
});
editor.on('SetContent', function () {
const drawings = editor.$('body > div[drawio-diagram]');
const drawings = editor.dom.select('body > div[drawio-diagram]');
if (!drawings.length) return;
editor.undoManager.transact(function () {

View File

@ -64,8 +64,8 @@ function register(editor, url) {
editor.insertContent(details.outerHTML);
editor.focus();
const domDetails = editor.dom.$(`[data-id="${id}"]`);
if (domDetails) {
const domDetails = editor.dom.select(`[data-id="${id}"]`);
if (!domDetails.length) {
const firstChild = domDetails.find('doc-root > *');
if (firstChild) {
firstChild[0].focus();

View File

@ -7,7 +7,7 @@ export function getPrimaryToolbar(options) {
const toolbar = [
'undo redo',
'styleselect',
'styles',
'bold italic underline forecolor backcolor formatoverflow',
'alignleft aligncenter alignright alignjustify',
'bullist numlist listoverflow',