Files
notesnook/apps/web/patches/tinymce+5.10.2.patch

104 lines
3.6 KiB
Diff
Raw Normal View History

diff --git a/node_modules/tinymce/plugins/table/plugin.js b/node_modules/tinymce/plugins/table/plugin.js
index e41249b..fb25fc5 100644
--- a/node_modules/tinymce/plugins/table/plugin.js
+++ b/node_modules/tinymce/plugins/table/plugin.js
@@ -1875,7 +1875,8 @@
var remove$5 = function (element) {
var dom = element.dom;
if (dom.parentNode !== null) {
- dom.parentNode.removeChild(dom);
+ if (dom.parentNode.classList.contains("table-container")) dom.parentNode.remove();
+ else dom.parentNode.removeChild(dom);
}
};
var unwrap = function (wrapper) {
@@ -7259,7 +7260,9 @@
editor.undoManager.ignore(function () {
var table = render(rows, columns, rowHeaders, colHeaders, getTableHeaderType(editor), options);
set$2(table, 'data-mce-id', '__mce');
+ set$2(table, "contenteditable", "true");
var html = getOuter(table);
+ html = `<div class="table-container" contenteditable="false">${html}</div><p><br data-mce-bogus="1"/></p>`;
editor.insertContent(html);
editor.addVisual();
});
@@ -9575,7 +9578,7 @@
var rootElements = [
'table',
'li',
- 'dl'
+ 'dl',
];
var handle$1 = function (event, editor, cellSelection) {
if (event.keyCode === global$1.TAB) {
diff --git a/node_modules/tinymce/plugins/textpattern/plugin.js b/node_modules/tinymce/plugins/textpattern/plugin.js
index 987d753..4c33998 100644
--- a/node_modules/tinymce/plugins/textpattern/plugin.js
+++ b/node_modules/tinymce/plugins/textpattern/plugin.js
@@ -1330,6 +1330,12 @@
});
};
+ var isCodeblock = function (editor) {
+ const node = editor.selection.getNode();
+ if (!node)return false;
+ return !!node.closest("pre");
+ }
+
var setup = function (editor, patternsState) {
var charCodes = [
',',
@@ -1341,6 +1347,8 @@
];
var keyCodes = [32];
editor.on('keydown', function (e) {
+ if (isCodeblock(editor)) return;
+
if (e.keyCode === 13 && !global$3.modifierPressed(e)) {
if (handleEnter(editor, patternsState.get())) {
e.preventDefault();
@@ -1348,11 +1356,15 @@
}
}, true);
editor.on('keyup', function (e) {
+ if (isCodeblock(editor)) return;
+
if (checkKeyCode(keyCodes, e)) {
handleInlineKey(editor, patternsState.get());
}
});
editor.on('keypress', function (e) {
+ if (isCodeblock(editor)) return;
+
if (checkCharCode(charCodes, e)) {
global$4.setEditorTimeout(editor, function () {
handleInlineKey(editor, patternsState.get());
diff --git a/node_modules/tinymce/tinymce.js b/node_modules/tinymce/tinymce.js
index 4cdbfce..3a4897a 100644
--- a/node_modules/tinymce/tinymce.js
+++ b/node_modules/tinymce/tinymce.js
@@ -24894,6 +24894,9 @@
var inPreBlock = function (requiredState) {
return inBlock('pre', requiredState);
};
+ var inTableCell = function (requiredState) {
+ return inBlock('td', requiredState) || inBlock('th', requiredState);
+ };
var inSummaryBlock = function () {
return inBlock('summary', true);
};
@@ -24925,6 +24928,13 @@
return evaluateUntil([
match([shouldBlockNewLine], newLineAction.none()),
match([inSummaryBlock()], newLineAction.br()),
+ match([
+ inTableCell(true),
+ hasShiftKey
+ ], newLineAction.br()),
+ match([
+ inTableCell(true)
+ ], newLineAction.br()),
match([
inPreBlock(true),
shouldPutBrInPre(false),