opentiny 6.9.17 → 6.9.19

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/tinymce.js CHANGED
@@ -14117,8 +14117,9 @@
14117
14117
  const currentValue = dom.getAttrib(elm, attrName);
14118
14118
  if (currentValue) {
14119
14119
  let valueOut = '';
14120
+ const editableClass = ed.getParam('editable_class');
14120
14121
  each$e(currentValue.split(/\s+/), cls => {
14121
- if (/mce\-\w+/.test(cls)) {
14122
+ if (/mce-\w+/.test(cls) || editableClass && cls === editableClass) {
14122
14123
  valueOut += (valueOut ? ' ' : '') + cls;
14123
14124
  }
14124
14125
  });
@@ -21423,12 +21424,39 @@
21423
21424
  editor.selection.setCursorLocation();
21424
21425
  });
21425
21426
  };
21427
+ const getClosestEditableDiv = editor => {
21428
+ const node = editor.selection.getNode();
21429
+ return node.closest(`.${ editor.getParam('editable_class') }`);
21430
+ };
21431
+ const emptyEditableDiv = (editor, editableDiv) => {
21432
+ return Optional.some(() => {
21433
+ editableDiv.innerHTML = '<p><br data-mce-bogus="1"></p>';
21434
+ editor.selection.setCursorLocation();
21435
+ });
21436
+ };
21426
21437
  const deleteRange$2 = editor => {
21427
- const rootNode = SugarElement.fromDom(editor.getBody());
21438
+ let rootNode;
21439
+ const editableDiv = getClosestEditableDiv(editor);
21428
21440
  const rng = editor.selection.getRng();
21441
+ if (!editor.hasEditableRoot() && editableDiv) {
21442
+ rootNode = SugarElement.fromDom(editableDiv);
21443
+ return isEverythingSelected(rootNode, rng) ? emptyEditableDiv(editor, editableDiv) : deleteRangeMergeBlocks(rootNode, editor.selection, editor.schema);
21444
+ }
21445
+ rootNode = SugarElement.fromDom(editor.getBody());
21429
21446
  return isEverythingSelected(rootNode, rng) ? emptyEditor(editor) : deleteRangeMergeBlocks(rootNode, editor.selection, editor.schema);
21430
21447
  };
21431
- const backspaceDelete$8 = (editor, _forward) => editor.selection.isCollapsed() ? Optional.none() : deleteRange$2(editor);
21448
+ const deleteSymbol = editor => {
21449
+ var _a;
21450
+ if (editor.hasEditableRoot()) {
21451
+ return Optional.none();
21452
+ }
21453
+ const editableDiv = getClosestEditableDiv(editor);
21454
+ if (((_a = editableDiv === null || editableDiv === void 0 ? void 0 : editableDiv.textContent) === null || _a === void 0 ? void 0 : _a.length) && editableDiv.textContent.length <= 1) {
21455
+ return emptyEditableDiv(editor, editableDiv);
21456
+ }
21457
+ return Optional.none();
21458
+ };
21459
+ const backspaceDelete$8 = (editor, _forward) => editor.selection.isCollapsed() ? deleteSymbol(editor) : deleteRange$2(editor);
21432
21460
 
21433
21461
  const showCaret = (direction, editor, node, before, scrollIntoView) => Optional.from(editor._selectionOverrides.showCaret(direction, node, before, scrollIntoView));
21434
21462
  const getNodeRange = node => {