@tiptap/core 2.0.0-beta.138 → 2.0.0-beta.141

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.
@@ -509,13 +509,19 @@ function resolveSelection(state, position = null) {
509
509
  to: 0,
510
510
  };
511
511
  }
512
+ const { size } = state.doc.content;
512
513
  if (position === 'end') {
513
- const { size } = state.doc.content;
514
514
  return {
515
515
  from: size,
516
516
  to: size,
517
517
  };
518
518
  }
519
+ if (position === 'all') {
520
+ return {
521
+ from: 0,
522
+ to: size,
523
+ };
524
+ }
519
525
  return {
520
526
  from: position,
521
527
  to: position,
@@ -2672,6 +2678,18 @@ function getSchemaTypeByName(name, schema) {
2672
2678
  return schema.nodes[name] || schema.marks[name] || null;
2673
2679
  }
2674
2680
 
2681
+ function isExtensionRulesEnabled(extension, enabled) {
2682
+ if (Array.isArray(enabled)) {
2683
+ return enabled.some(enabledExtension => {
2684
+ const name = typeof enabledExtension === 'string'
2685
+ ? enabledExtension
2686
+ : enabledExtension.name;
2687
+ return name === extension.name;
2688
+ });
2689
+ }
2690
+ return enabled;
2691
+ }
2692
+
2675
2693
  function findDuplicates(items) {
2676
2694
  const filtered = items.filter((el, index) => items.indexOf(el) !== index);
2677
2695
  return [...new Set(filtered)];
@@ -2826,11 +2844,11 @@ class ExtensionManager {
2826
2844
  plugins.push(keyMapPlugin);
2827
2845
  }
2828
2846
  const addInputRules = getExtensionField(extension, 'addInputRules', context);
2829
- if (editor.options.enableInputRules && addInputRules) {
2847
+ if (isExtensionRulesEnabled(extension, editor.options.enableInputRules) && addInputRules) {
2830
2848
  inputRules.push(...addInputRules());
2831
2849
  }
2832
2850
  const addPasteRules = getExtensionField(extension, 'addPasteRules', context);
2833
- if (editor.options.enablePasteRules && addPasteRules) {
2851
+ if (isExtensionRulesEnabled(extension, editor.options.enablePasteRules) && addPasteRules) {
2834
2852
  pasteRules.push(...addPasteRules());
2835
2853
  }
2836
2854
  const addProseMirrorPlugins = getExtensionField(extension, 'addProseMirrorPlugins', context);
@@ -2962,6 +2980,7 @@ img.ProseMirror-separator {
2962
2980
  display: none;
2963
2981
  pointer-events: none;
2964
2982
  position: absolute;
2983
+ margin: 0;
2965
2984
  }
2966
2985
 
2967
2986
  .ProseMirror-gapcursor:after {
@@ -3628,7 +3647,10 @@ class NodeView {
3628
3647
  // this is because ProseMirror can’t preventDispatch on enter
3629
3648
  // this will lead to a re-render of the node view on enter
3630
3649
  // see: https://github.com/ueberdosis/tiptap/issues/1214
3631
- if (this.dom.contains(mutation.target) && mutation.type === 'childList' && isiOS()) {
3650
+ if (this.dom.contains(mutation.target)
3651
+ && mutation.type === 'childList'
3652
+ && isiOS()
3653
+ && this.editor.isFocused) {
3632
3654
  const changedNodes = [
3633
3655
  ...Array.from(mutation.addedNodes),
3634
3656
  ...Array.from(mutation.removedNodes),