slate 0.75.0 → 0.76.0-20222246256
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/dist/create-editor.d.ts.map +1 -1
- package/dist/index.es.js +22 -3
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +22 -3
- package/dist/index.js.map +1 -1
- package/dist/interfaces/editor.d.ts +3 -0
- package/dist/interfaces/editor.d.ts.map +1 -1
- package/dist/slate.js +22 -3
- package/dist/slate.min.js +2 -2
- package/dist/transforms/node.d.ts +2 -1
- package/dist/transforms/node.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-editor.d.ts","sourceRoot":"","sources":["packages/slate/src/create-editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAYP,MAAM,IAAI,CAAA;AAGX;;GAEG;AAEH,eAAO,MAAM,YAAY,QAAO,
|
|
1
|
+
{"version":3,"file":"create-editor.d.ts","sourceRoot":"","sources":["packages/slate/src/create-editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAYP,MAAM,IAAI,CAAA;AAGX;;GAEG;AAEH,eAAO,MAAM,YAAY,QAAO,MAuR/B,CAAA"}
|
package/dist/index.es.js
CHANGED
|
@@ -183,6 +183,11 @@ var createEditor = () => {
|
|
|
183
183
|
always: true
|
|
184
184
|
});
|
|
185
185
|
},
|
|
186
|
+
insertSoftBreak: () => {
|
|
187
|
+
Transforms.splitNodes(editor, {
|
|
188
|
+
always: true
|
|
189
|
+
});
|
|
190
|
+
},
|
|
186
191
|
insertFragment: fragment => {
|
|
187
192
|
Transforms.insertFragment(editor, fragment);
|
|
188
193
|
},
|
|
@@ -1045,6 +1050,15 @@ var Editor = {
|
|
|
1045
1050
|
editor.insertBreak();
|
|
1046
1051
|
},
|
|
1047
1052
|
|
|
1053
|
+
/**
|
|
1054
|
+
* Insert a soft break at the current selection.
|
|
1055
|
+
*
|
|
1056
|
+
* If the selection is currently expanded, it will be deleted first.
|
|
1057
|
+
*/
|
|
1058
|
+
insertSoftBreak(editor) {
|
|
1059
|
+
editor.insertSoftBreak();
|
|
1060
|
+
},
|
|
1061
|
+
|
|
1048
1062
|
/**
|
|
1049
1063
|
* Insert a fragment at the current selection.
|
|
1050
1064
|
*
|
|
@@ -1090,7 +1104,7 @@ var Editor = {
|
|
|
1090
1104
|
return cachedIsEditor;
|
|
1091
1105
|
}
|
|
1092
1106
|
|
|
1093
|
-
var isEditor = typeof value.addMark === 'function' && typeof value.apply === 'function' && typeof value.deleteBackward === 'function' && typeof value.deleteForward === 'function' && typeof value.deleteFragment === 'function' && typeof value.insertBreak === 'function' && typeof value.insertFragment === 'function' && typeof value.insertNode === 'function' && typeof value.insertText === 'function' && typeof value.isInline === 'function' && typeof value.isVoid === 'function' && typeof value.normalizeNode === 'function' && typeof value.onChange === 'function' && typeof value.removeMark === 'function' && (value.marks === null || isPlainObject(value.marks)) && (value.selection === null || Range.isRange(value.selection)) && Node.isNodeList(value.children) && Operation.isOperationList(value.operations);
|
|
1107
|
+
var isEditor = typeof value.addMark === 'function' && typeof value.apply === 'function' && typeof value.deleteBackward === 'function' && typeof value.deleteForward === 'function' && typeof value.deleteFragment === 'function' && typeof value.insertBreak === 'function' && typeof value.insertSoftBreak === 'function' && typeof value.insertFragment === 'function' && typeof value.insertNode === 'function' && typeof value.insertText === 'function' && typeof value.isInline === 'function' && typeof value.isVoid === 'function' && typeof value.normalizeNode === 'function' && typeof value.onChange === 'function' && typeof value.removeMark === 'function' && (value.marks === null || isPlainObject(value.marks)) && (value.selection === null || Range.isRange(value.selection)) && Node.isNodeList(value.children) && Operation.isOperationList(value.operations);
|
|
1094
1108
|
IS_EDITOR_CACHE.set(value, isEditor);
|
|
1095
1109
|
return isEditor;
|
|
1096
1110
|
},
|
|
@@ -4727,7 +4741,8 @@ var NodeTransforms = {
|
|
|
4727
4741
|
var {
|
|
4728
4742
|
match,
|
|
4729
4743
|
at = editor.selection,
|
|
4730
|
-
compare
|
|
4744
|
+
compare,
|
|
4745
|
+
merge
|
|
4731
4746
|
} = options;
|
|
4732
4747
|
var {
|
|
4733
4748
|
hanging = false,
|
|
@@ -4812,7 +4827,11 @@ var NodeTransforms = {
|
|
|
4812
4827
|
|
|
4813
4828
|
if (node.hasOwnProperty(k)) properties[k] = node[k]; // Omit properties that have been removed from the new properties list
|
|
4814
4829
|
|
|
4815
|
-
if (
|
|
4830
|
+
if (merge) {
|
|
4831
|
+
if (props[k] != null) newProperties[k] = merge(node[k], props[k]);
|
|
4832
|
+
} else {
|
|
4833
|
+
if (props[k] != null) newProperties[k] = props[k];
|
|
4834
|
+
}
|
|
4816
4835
|
}
|
|
4817
4836
|
}
|
|
4818
4837
|
|