mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-01 22:39:13 +08:00
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:
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -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 () {
|
||||
|
@ -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();
|
||||
|
@ -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',
|
||||
|
Reference in New Issue
Block a user