@ones-editor/editor 2.8.15-beta.2 → 2.8.15
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/@ones-editor/core/src/core/editor/actions/break-text-block.d.ts +1 -1
- package/@ones-editor/core/src/core/types.d.ts +1 -0
- package/@ones-editor/list-block/src/index.d.ts +1 -0
- package/@ones-editor/list-block/src/keyboard/enter.d.ts +3 -1
- package/@ones-editor/list-block/src/keyboard/index.d.ts +2 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/dist/helper/break-text-block.d.ts +2 -0
- package/dist/helper/index.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +28 -12
- package/package.json +1 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { type BlockElement, type BreakTextBlockResult, type BreakTextOptions, type OnesEditor } from '../../@ones-editor/core';
|
|
2
|
+
export declare function editorAutoBreakTextBlock(editor: OnesEditor, block: BlockElement, offset: number, options?: BreakTextOptions): BreakTextBlockResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './break-text-block';
|
package/dist/index.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ export * from '../@ones-editor/templates';
|
|
|
44
44
|
export * from 'tiny-typed-emitter';
|
|
45
45
|
export { ShareDBDocVersionsProvider, OnesEditorIcons, isLayoutBlock, LayoutQuickMenuItemFilter, CalloutQuickMenuItemFilter, MobileCommandHandler, PasteSpecialHandler };
|
|
46
46
|
export type { FileBoxData, FileEmbedData } from '../@ones-editor/file';
|
|
47
|
+
export * from './helper';
|
|
47
48
|
export { type DocListBlock } from '../@ones-editor/list-block';
|
|
48
49
|
export declare function getDefaultOnesEditorOptions(options: CreateOnesEditorOptions): {
|
|
49
50
|
id: string | undefined;
|
package/dist/index.js
CHANGED
|
@@ -26677,15 +26677,20 @@ var __publicField = (obj, key, value) => {
|
|
|
26677
26677
|
return deleteCount;
|
|
26678
26678
|
}
|
|
26679
26679
|
const logger$3I = getLogger("break-text-block");
|
|
26680
|
-
function copyBlockAttributes(editor, block) {
|
|
26680
|
+
function copyBlockAttributes(editor, block, options) {
|
|
26681
26681
|
const blockData = editor.getBlockData(block);
|
|
26682
26682
|
const quoted = blockData.quoted;
|
|
26683
|
+
const ret = {};
|
|
26683
26684
|
if (quoted) {
|
|
26684
|
-
|
|
26685
|
-
quoted
|
|
26686
|
-
};
|
|
26685
|
+
ret.quoted = quoted;
|
|
26687
26686
|
}
|
|
26688
|
-
|
|
26687
|
+
if (options == null ? void 0 : options.copyHeading) {
|
|
26688
|
+
const heading = blockData.heading;
|
|
26689
|
+
if (heading) {
|
|
26690
|
+
ret.heading = heading;
|
|
26691
|
+
}
|
|
26692
|
+
}
|
|
26693
|
+
return ret;
|
|
26689
26694
|
}
|
|
26690
26695
|
function editorBreakTextBlock(editor, block, offset, options) {
|
|
26691
26696
|
assert(logger$3I, isTextKindBlock(editor, block), `block is not a text kind block: ${getBlockType(block)}`);
|
|
@@ -51661,16 +51666,22 @@ ${codeText}
|
|
|
51661
51666
|
function breakListBlock(editor, block, offset, attributesBlock) {
|
|
51662
51667
|
const fixStart = new FixStartByList(editor, attributesBlock);
|
|
51663
51668
|
const start = getListBlockStart(attributesBlock) + 1;
|
|
51664
|
-
editorBreakTextBlock(editor, block, offset, {
|
|
51669
|
+
const result = editorBreakTextBlock(editor, block, offset, {
|
|
51665
51670
|
forceInsertAfter: true,
|
|
51666
51671
|
newBlockData: cloneListData(editor, attributesBlock, {
|
|
51667
51672
|
start
|
|
51668
51673
|
})
|
|
51669
51674
|
});
|
|
51670
51675
|
fixStart.fix();
|
|
51676
|
+
return result;
|
|
51671
51677
|
}
|
|
51672
|
-
function
|
|
51678
|
+
function autoBreakListBlock(editor, block, offset) {
|
|
51673
51679
|
var _a;
|
|
51680
|
+
const atBlockEnd = offset === getBlockTextLength$6(editor, block);
|
|
51681
|
+
const attributesBlock = (_a = atBlockEnd ? findCloneableList(block) : block) != null ? _a : block;
|
|
51682
|
+
return breakListBlock(editor, block, offset, attributesBlock);
|
|
51683
|
+
}
|
|
51684
|
+
function handleEnter$1(editor) {
|
|
51674
51685
|
if (editor.selection.range.isCollapsed()) {
|
|
51675
51686
|
const block2 = editor.selection.focusedBlock;
|
|
51676
51687
|
if (isListBlock(block2)) {
|
|
@@ -51694,9 +51705,7 @@ ${codeText}
|
|
|
51694
51705
|
return false;
|
|
51695
51706
|
}
|
|
51696
51707
|
const offset = focus.offset;
|
|
51697
|
-
|
|
51698
|
-
const attributesBlock = (_a = atBlockEnd ? findCloneableList(block) : block) != null ? _a : block;
|
|
51699
|
-
breakListBlock(editor, block, offset, attributesBlock);
|
|
51708
|
+
autoBreakListBlock(editor, block, offset);
|
|
51700
51709
|
return true;
|
|
51701
51710
|
}
|
|
51702
51711
|
function findPrevBrotherAsParent(block) {
|
|
@@ -92535,6 +92544,12 @@ ${data2.plantumlText}
|
|
|
92535
92544
|
this.toolbar.updateItems(items);
|
|
92536
92545
|
}
|
|
92537
92546
|
}
|
|
92547
|
+
function editorAutoBreakTextBlock(editor, block, offset, options) {
|
|
92548
|
+
if (isListBlock(block)) {
|
|
92549
|
+
return autoBreakListBlock(editor, block, offset);
|
|
92550
|
+
}
|
|
92551
|
+
return editorBreakTextBlock(editor, block, offset, options);
|
|
92552
|
+
}
|
|
92538
92553
|
const logger = getLogger("create-editor");
|
|
92539
92554
|
function getDefaultOnesEditorOptions(options) {
|
|
92540
92555
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
@@ -92782,7 +92797,7 @@ ${data2.plantumlText}
|
|
|
92782
92797
|
}
|
|
92783
92798
|
}
|
|
92784
92799
|
});
|
|
92785
|
-
editor.version = "2.8.15
|
|
92800
|
+
editor.version = "2.8.15";
|
|
92786
92801
|
return editor;
|
|
92787
92802
|
}
|
|
92788
92803
|
function isDoc(doc2) {
|
|
@@ -92895,7 +92910,7 @@ ${data2.plantumlText}
|
|
|
92895
92910
|
}
|
|
92896
92911
|
});
|
|
92897
92912
|
OnesEditorToolbar.register(editor);
|
|
92898
|
-
editor.version = "2.8.15
|
|
92913
|
+
editor.version = "2.8.15";
|
|
92899
92914
|
return editor;
|
|
92900
92915
|
}
|
|
92901
92916
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -139080,6 +139095,7 @@ ${data2.plantumlText}
|
|
|
139080
139095
|
exports2.editLink = editLink;
|
|
139081
139096
|
exports2.editorAddComment = editorAddComment;
|
|
139082
139097
|
exports2.editorAddTextAttribute = editorAddTextAttribute;
|
|
139098
|
+
exports2.editorAutoBreakTextBlock = editorAutoBreakTextBlock;
|
|
139083
139099
|
exports2.editorAutoInsertBlock = editorAutoInsertBlock;
|
|
139084
139100
|
exports2.editorBreakTextBlock = editorBreakTextBlock;
|
|
139085
139101
|
exports2.editorClearCompositionText = editorClearCompositionText;
|