Skip to content

Commit

Permalink
Merge pull request #3110 from movabletype/fix/update_tinymce6_mt80
Browse files Browse the repository at this point in the history
[MT80] Update tinymce6 MTC-29614
  • Loading branch information
charsbar committed Apr 23, 2024
2 parents 0370506 + e1585ef commit e9b9cfc
Show file tree
Hide file tree
Showing 138 changed files with 2,472 additions and 1,794 deletions.
2 changes: 1 addition & 1 deletion mt-static/plugins/TinyMCE6/tiny_mce/models/dom/model.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* TinyMCE version 6.7.3 (2023-11-15)
* TinyMCE version 6.8.3 (2024-02-08)
*/

(function () {
Expand Down

Large diffs are not rendered by default.

57 changes: 39 additions & 18 deletions mt-static/plugins/TinyMCE6/tiny_mce/plugins/accordion/plugin.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/**
* TinyMCE version 6.7.3 (2023-11-15)
* TinyMCE version 6.8.3 (2024-02-08)
*/

(function () {
'use strict';

var global$3 = tinymce.util.Tools.resolve('tinymce.PluginManager');
var global$4 = tinymce.util.Tools.resolve('tinymce.PluginManager');

let unique = 0;
const generate = prefix => {
Expand Down Expand Up @@ -735,7 +735,7 @@
const accordionBodyWrapperClass = 'mce-accordion-body';
const accordionBodyWrapperTag = 'div';

var global$2 = tinymce.util.Tools.resolve('tinymce.util.Tools');
var global$3 = tinymce.util.Tools.resolve('tinymce.util.Tools');

const isSummary = node => (node === null || node === void 0 ? void 0 : node.nodeName) === 'SUMMARY';
const isDetails = node => (node === null || node === void 0 ? void 0 : node.nodeName) === 'DETAILS';
Expand All @@ -744,6 +744,10 @@
const node = editor.selection.getNode();
return isSummary(node) || Boolean(editor.dom.getParent(node, isSummary));
};
const isAtDetailsStart = editor => {
const rng = editor.selection.getRng();
return isDetails(rng.startContainer) && rng.collapsed && rng.startOffset === 0;
};
const isInsertAllowed = editor => !isInSummary(editor) && editor.dom.isEditable(editor.selection.getNode());
const getSelectedDetails = editor => Optional.from(editor.dom.getParent(editor.selection.getNode(), isDetails));
const isDetailsSelected = editor => getSelectedDetails(editor).isSome();
Expand Down Expand Up @@ -777,7 +781,7 @@
normalizeSummary(editor, accordion);
};
const normalizeDetails = editor => {
global$2.each(global$2.grep(editor.dom.select('details', editor.getBody())), normalizeAccordion(editor));
global$3.each(global$3.grep(editor.dom.select('details', editor.getBody())), normalizeAccordion(editor));
};

const insertAccordion = editor => {
Expand Down Expand Up @@ -851,7 +855,7 @@
editor.addCommand('RemoveAccordion', () => removeAccordion(editor));
};

var global$1 = tinymce.util.Tools.resolve('tinymce.html.Node');
var global$2 = tinymce.util.Tools.resolve('tinymce.html.Node');

const getClassList = node => {
var _a, _b;
Expand Down Expand Up @@ -895,12 +899,12 @@
};
};
const padInputNode = node => {
const br = new global$1('br', 1);
const br = new global$2('br', 1);
br.attr('data-mce-bogus', '1');
node.empty();
node.append(br);
};
const setup$1 = editor => {
const setup$2 = editor => {
editor.on('PreInit', () => {
const {serializer, parser} = editor;
parser.addNodeFilter(accordionTag, nodes => {
Expand All @@ -910,7 +914,7 @@
const accordionNode = node;
const {summaryNode, wrapperNode, otherNodes} = getAccordionChildren(accordionNode);
const hasSummaryNode = isNonNullable(summaryNode);
const newSummaryNode = hasSummaryNode ? summaryNode : new global$1('summary', 1);
const newSummaryNode = hasSummaryNode ? summaryNode : new global$2('summary', 1);
if (isNullable(newSummaryNode.firstChild)) {
padInputNode(newSummaryNode);
}
Expand All @@ -923,7 +927,8 @@
}
}
const hasWrapperNode = isNonNullable(wrapperNode);
const newWrapperNode = hasWrapperNode ? wrapperNode : new global$1(accordionBodyWrapperTag, 1);
const newWrapperNode = hasWrapperNode ? wrapperNode : new global$2(accordionBodyWrapperTag, 1);
newWrapperNode.attr('data-mce-bogus', '1');
addClasses(newWrapperNode, [accordionBodyWrapperClass]);
if (otherNodes.length > 0) {
for (let j = 0; j < otherNodes.length; j++) {
Expand All @@ -932,7 +937,7 @@
}
}
if (isNullable(newWrapperNode.firstChild)) {
const pNode = new global$1('p', 1);
const pNode = new global$2('p', 1);
padInputNode(pNode);
newWrapperNode.append(pNode);
}
Expand Down Expand Up @@ -961,18 +966,17 @@
});
};

var global = tinymce.util.Tools.resolve('tinymce.util.VK');
var global$1 = tinymce.util.Tools.resolve('tinymce.util.VK');

const setupEnterKeyInSummary = editor => {
editor.on('keydown', event => {
if (event.shiftKey || event.keyCode !== global.ENTER || !isInSummary(editor)) {
return;
if (!event.shiftKey && event.keyCode === global$1.ENTER && isInSummary(editor) || isAtDetailsStart(editor)) {
event.preventDefault();
editor.execCommand('ToggleAccordion');
}
event.preventDefault();
editor.execCommand('ToggleAccordion');
});
};
const setup = editor => {
const setup$1 = editor => {
setupEnterKeyInSummary(editor);
editor.on('ExecCommand', e => {
const cmd = e.command.toLowerCase();
Expand All @@ -982,6 +986,22 @@
});
};

var global = tinymce.util.Tools.resolve('tinymce.Env');

const setup = editor => {
if (global.browser.isSafari()) {
editor.on('click', e => {
if (isSummary(e.target)) {
const summary = e.target;
const rng = editor.selection.getRng();
if (rng.collapsed && rng.startContainer === summary.parentNode && rng.startOffset === 0) {
editor.selection.setCursorLocation(summary, 0);
}
}
});
}
};

const onSetup = editor => buttonApi => {
const onNodeChange = () => buttonApi.setEnabled(isInsertAllowed(editor));
editor.on('NodeChange', onNodeChange);
Expand Down Expand Up @@ -1020,11 +1040,12 @@
};

var Plugin = () => {
global$3.add('accordion', editor => {
global$4.add('accordion', editor => {
register(editor);
register$1(editor);
setup(editor);
setup$1(editor);
setup$2(editor);
setup(editor);
});
};

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* TinyMCE version 6.7.3 (2023-11-15)
* TinyMCE version 6.8.3 (2024-02-08)
*/

(function () {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* TinyMCE version 6.7.3 (2023-11-15)
* TinyMCE version 6.8.3 (2024-02-08)
*/

(function () {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* TinyMCE version 6.7.3 (2023-11-15)
* TinyMCE version 6.8.3 (2024-02-08)
*/

(function () {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* TinyMCE version 6.7.3 (2023-11-15)
* TinyMCE version 6.8.3 (2024-02-08)
*/

(function () {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* TinyMCE version 6.7.3 (2023-11-15)
* TinyMCE version 6.8.3 (2024-02-08)
*/

(function () {
Expand Down

0 comments on commit e9b9cfc

Please sign in to comment.