opentiny 6.9.25 → 6.9.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/themes/silver/theme.js
CHANGED
|
@@ -10250,6 +10250,75 @@
|
|
|
10250
10250
|
items: menu.items
|
|
10251
10251
|
}));
|
|
10252
10252
|
};
|
|
10253
|
+
const filterContextMenu = (menu, allowed) => {
|
|
10254
|
+
if (allowed.length === 0) {
|
|
10255
|
+
return '';
|
|
10256
|
+
}
|
|
10257
|
+
const allowedSet = new Set(allowed);
|
|
10258
|
+
const filteredGroups = menu.split('|').map(group => group.trim()).map(group => group.length === 0 ? [] : group.split(/\s+/).filter(item => allowedSet.has(item))).filter(items => items.length > 0).map(items => items.join(' '));
|
|
10259
|
+
return filteredGroups.join(' | ');
|
|
10260
|
+
};
|
|
10261
|
+
const flattenContextMenu = (menu, replacements) => {
|
|
10262
|
+
const groups = menu.split('|').map(group => group.trim()).filter(group => group.length > 0);
|
|
10263
|
+
const flattened = [];
|
|
10264
|
+
const addGroup = items => {
|
|
10265
|
+
if (items.length > 0) {
|
|
10266
|
+
flattened.push(items.join(' '));
|
|
10267
|
+
}
|
|
10268
|
+
};
|
|
10269
|
+
each$1(groups, group => {
|
|
10270
|
+
const tokens = group.split(/\s+/).filter(token => token.length > 0);
|
|
10271
|
+
let current = [];
|
|
10272
|
+
each$1(tokens, token => {
|
|
10273
|
+
const replacement = replacements[token];
|
|
10274
|
+
if (replacement === undefined) {
|
|
10275
|
+
current.push(token);
|
|
10276
|
+
} else if (replacement.length === 0) {
|
|
10277
|
+
return;
|
|
10278
|
+
} else {
|
|
10279
|
+
const replacementGroups = replacement.split('|').map(repGroup => repGroup.trim()).filter(repGroup => repGroup.length > 0);
|
|
10280
|
+
if (replacementGroups.length === 1) {
|
|
10281
|
+
current = current.concat(replacementGroups[0].split(/\s+/).filter(item => item.length > 0));
|
|
10282
|
+
} else {
|
|
10283
|
+
addGroup(current);
|
|
10284
|
+
current = [];
|
|
10285
|
+
each$1(replacementGroups, repGroup => {
|
|
10286
|
+
addGroup(repGroup.split(/\s+/).filter(item => item.length > 0));
|
|
10287
|
+
});
|
|
10288
|
+
}
|
|
10289
|
+
}
|
|
10290
|
+
});
|
|
10291
|
+
addGroup(current);
|
|
10292
|
+
});
|
|
10293
|
+
return flattened.join(' | ');
|
|
10294
|
+
};
|
|
10295
|
+
const getFilteredTableMenuItems = (editor, menu) => {
|
|
10296
|
+
var _a, _b, _c, _d;
|
|
10297
|
+
if (!editor.options.isRegistered('table_contextmenu')) {
|
|
10298
|
+
return menu;
|
|
10299
|
+
}
|
|
10300
|
+
const isTableContextMenuSet = editor.options.isSet('table_contextmenu');
|
|
10301
|
+
const contextItems = (_a = editor.options.get('table_contextmenu')) !== null && _a !== void 0 ? _a : [];
|
|
10302
|
+
const tableContextMenu = contextItems.length > 0 ? [
|
|
10303
|
+
'inserttable',
|
|
10304
|
+
...contextItems
|
|
10305
|
+
] : [];
|
|
10306
|
+
const filteredMenu = isTableContextMenuSet ? tableContextMenu.join(' ') : menu;
|
|
10307
|
+
if (!editor.options.get('table_contextmenu_flatten') || filteredMenu.length === 0) {
|
|
10308
|
+
return filteredMenu;
|
|
10309
|
+
}
|
|
10310
|
+
const rowMenuItems = 'tableinsertrowbefore tableinsertrowafter tabledeleterow tablerowprops | tablecutrow tablecopyrow tablepasterowbefore tablepasterowafter';
|
|
10311
|
+
const columnMenuItems = 'tableinsertcolumnbefore tableinsertcolumnafter tabledeletecolumn | tablecutcolumn tablecopycolumn tablepastecolumnbefore tablepastecolumnafter';
|
|
10312
|
+
const cellMenuItems = 'tablecellprops tablemergecells tablesplitcells';
|
|
10313
|
+
const filteredRowMenuItems = editor.options.isSet('table_row_contextmenu') ? filterContextMenu(rowMenuItems, (_b = editor.options.get('table_row_contextmenu')) !== null && _b !== void 0 ? _b : []) : rowMenuItems;
|
|
10314
|
+
const filteredColumnMenuItems = editor.options.isSet('table_column_contextmenu') ? filterContextMenu(columnMenuItems, (_c = editor.options.get('table_column_contextmenu')) !== null && _c !== void 0 ? _c : []) : columnMenuItems;
|
|
10315
|
+
const filteredCellMenuItems = editor.options.isSet('table_cell_contextmenu') ? filterContextMenu(cellMenuItems, (_d = editor.options.get('table_cell_contextmenu')) !== null && _d !== void 0 ? _d : []) : cellMenuItems;
|
|
10316
|
+
return flattenContextMenu(filteredMenu, {
|
|
10317
|
+
cell: filteredCellMenuItems,
|
|
10318
|
+
row: filteredRowMenuItems,
|
|
10319
|
+
column: filteredColumnMenuItems
|
|
10320
|
+
});
|
|
10321
|
+
};
|
|
10253
10322
|
|
|
10254
10323
|
var Options = /*#__PURE__*/Object.freeze({
|
|
10255
10324
|
__proto__: null,
|
|
@@ -10305,7 +10374,8 @@
|
|
|
10305
10374
|
getPasteAsText: getPasteAsText,
|
|
10306
10375
|
getSidebarShow: getSidebarShow,
|
|
10307
10376
|
useHelpAccessibility: useHelpAccessibility,
|
|
10308
|
-
getDefaultFontStack: getDefaultFontStack
|
|
10377
|
+
getDefaultFontStack: getDefaultFontStack,
|
|
10378
|
+
getFilteredTableMenuItems: getFilteredTableMenuItems
|
|
10309
10379
|
});
|
|
10310
10380
|
|
|
10311
10381
|
const setup$e = (api, editor) => {
|
|
@@ -23400,9 +23470,10 @@
|
|
|
23400
23470
|
});
|
|
23401
23471
|
const menus = map$2(validMenus, menuName => {
|
|
23402
23472
|
const menuData = rawMenuData[menuName];
|
|
23473
|
+
const items = menuName === 'table' ? parseItemsString(getFilteredTableMenuItems(editor, menuData.items)) : parseItemsString(menuData.items);
|
|
23403
23474
|
return make({
|
|
23404
23475
|
title: menuData.title,
|
|
23405
|
-
items
|
|
23476
|
+
items
|
|
23406
23477
|
}, registry, editor);
|
|
23407
23478
|
});
|
|
23408
23479
|
return filter$2(menus, menu => {
|