@ones-editor/editor 2.9.8-beta.1 → 2.9.8-beta.10
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/cke-html/package.json +7 -0
- package/@ones-editor/cke-html/src/html/cke-html.d.ts +4 -0
- package/@ones-editor/cke-html/src/html/combine-html.d.ts +2 -0
- package/@ones-editor/cke-html/src/html/comment.d.ts +6 -0
- package/@ones-editor/cke-html/src/html/converter.d.ts +7 -0
- package/@ones-editor/cke-html/src/html/data-helper/link-data.d.ts +0 -0
- package/@ones-editor/cke-html/src/html/image.d.ts +4 -0
- package/@ones-editor/cke-html/src/html/link.d.ts +2 -0
- package/@ones-editor/cke-html/src/html/markdown.d.ts +2 -0
- package/@ones-editor/cke-html/src/html/mention.d.ts +4 -0
- package/@ones-editor/cke-html/src/index.d.ts +2 -0
- package/@ones-editor/core/src/core/doc/doc.d.ts +1 -1
- package/@ones-editor/core/src/core/types.d.ts +1 -0
- package/@ones-editor/core/src/users/remote-users.d.ts +1 -1
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui-base/src/command-bar/types.d.ts +5 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +323 -37
- package/package.json +1 -1
|
@@ -69,9 +69,14 @@ export interface CommandBarOptions {
|
|
|
69
69
|
beforeClose?: (event?: MouseEvent | TouchEvent) => boolean;
|
|
70
70
|
showName?: boolean;
|
|
71
71
|
maxWidth?: number | string;
|
|
72
|
+
appendTo?: Element;
|
|
72
73
|
}
|
|
73
74
|
export type CreateManualCommandBarFunction = (parentItem: CommandItem, closeable: Closeable, options?: CommandBarOptions) => AbstractManualCommandBar;
|
|
74
75
|
export type PopoverOptions = {
|
|
75
76
|
overflowBoundary?: Element;
|
|
77
|
+
appendTo?: Element;
|
|
78
|
+
};
|
|
79
|
+
export type ObjectToolbarOptions = {
|
|
80
|
+
appendTo?: Element;
|
|
76
81
|
};
|
|
77
82
|
export type SelectItemFrom = 'event' | 'manual';
|
package/dist/index.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export { ShareDBDocVersionsProvider, OnesEditorIcons, isLayoutBlock, LayoutQuick
|
|
|
46
46
|
export type { FileBoxData, FileEmbedData } from '../@ones-editor/file';
|
|
47
47
|
export * from './helper';
|
|
48
48
|
export { OnesEditorComments, OnesEditorCommentsRender } from '../@ones-editor/comments';
|
|
49
|
+
export * from '../@ones-editor/cke-html';
|
|
49
50
|
export { type DocListBlock } from '../@ones-editor/list-block';
|
|
50
51
|
export declare function getDefaultOnesEditorOptions(options: CreateOnesEditorOptions): {
|
|
51
52
|
id: string | undefined;
|
package/dist/index.js
CHANGED
|
@@ -24898,18 +24898,11 @@ var __publicField = (obj, key, value) => {
|
|
|
24898
24898
|
};
|
|
24899
24899
|
}
|
|
24900
24900
|
function isEmptyDoc(doc2) {
|
|
24901
|
-
const
|
|
24902
|
-
|
|
24903
|
-
return
|
|
24904
|
-
}
|
|
24905
|
-
|
|
24906
|
-
if (!block.text) {
|
|
24907
|
-
return false;
|
|
24908
|
-
}
|
|
24909
|
-
if (getTextLength(block.text)) {
|
|
24910
|
-
return false;
|
|
24911
|
-
}
|
|
24912
|
-
return true;
|
|
24901
|
+
const blocks = doc2.blocks.root;
|
|
24902
|
+
const ret = blocks.every((block) => {
|
|
24903
|
+
return block.type === "text" && getTextLength(block.text || []) === 0;
|
|
24904
|
+
});
|
|
24905
|
+
return ret;
|
|
24913
24906
|
}
|
|
24914
24907
|
function createContainer$1(doc2, docsOrDocObject) {
|
|
24915
24908
|
const containerId = genId();
|
|
@@ -26352,9 +26345,10 @@ var __publicField = (obj, key, value) => {
|
|
|
26352
26345
|
const y2 = rect.bottom > windowHeight ? windowHeight : rect.bottom;
|
|
26353
26346
|
const centerX = (x1 + x2) / 2;
|
|
26354
26347
|
const centerY = (y1 + y2) / 2;
|
|
26355
|
-
const x = 0 - rect.left + centerX;
|
|
26356
|
-
const y = 0 - rect.top + centerY + container.scrollTop;
|
|
26357
26348
|
const input2 = editor.input.inputElement;
|
|
26349
|
+
const inputHeight = input2.getBoundingClientRect().height;
|
|
26350
|
+
const x = 0 - rect.left + centerX;
|
|
26351
|
+
const y = 0 - rect.top + centerY + container.scrollTop - inputHeight / 2;
|
|
26358
26352
|
input2.style.left = `${x / scale}px`;
|
|
26359
26353
|
input2.style.top = `${y / scale}px`;
|
|
26360
26354
|
}
|
|
@@ -31956,6 +31950,7 @@ ${codeText}
|
|
|
31956
31950
|
__publicField(this, "settingsProvider");
|
|
31957
31951
|
__publicField(this, "_readonly", false);
|
|
31958
31952
|
__publicField(this, "_scrollable", true);
|
|
31953
|
+
__publicField(this, "_destroyed", false);
|
|
31959
31954
|
__publicField(this, "getColor", (index2) => {
|
|
31960
31955
|
const colors = this.options.colors;
|
|
31961
31956
|
if (colors.length === 0) {
|
|
@@ -32095,6 +32090,10 @@ ${codeText}
|
|
|
32095
32090
|
this.domEvents.destroy();
|
|
32096
32091
|
this.removeAllListeners();
|
|
32097
32092
|
this.inputHandlers.destroy();
|
|
32093
|
+
this._destroyed = true;
|
|
32094
|
+
}
|
|
32095
|
+
get destroyed() {
|
|
32096
|
+
return this._destroyed;
|
|
32098
32097
|
}
|
|
32099
32098
|
focus(options) {
|
|
32100
32099
|
this.input.focus(options);
|
|
@@ -32386,11 +32385,17 @@ ${codeText}
|
|
|
32386
32385
|
this.emit("change", Array.from(this.users.values()));
|
|
32387
32386
|
}, 300);
|
|
32388
32387
|
}
|
|
32389
|
-
getSimpleCursors(blockId) {
|
|
32388
|
+
getSimpleCursors(blockId, excludeUserId) {
|
|
32390
32389
|
const ret = /* @__PURE__ */ new Map();
|
|
32391
32390
|
Array.from(this.cursors.values()).filter((message) => {
|
|
32392
32391
|
const ret2 = message.range.anchor.blockId === blockId && isSimpleRange(message.range);
|
|
32393
|
-
|
|
32392
|
+
if (!ret2) {
|
|
32393
|
+
return false;
|
|
32394
|
+
}
|
|
32395
|
+
if (excludeUserId && excludeUserId === message.user.userId) {
|
|
32396
|
+
return false;
|
|
32397
|
+
}
|
|
32398
|
+
return true;
|
|
32394
32399
|
}).forEach((message) => {
|
|
32395
32400
|
const offset = message.range.focus.offset;
|
|
32396
32401
|
let users = ret.get(offset);
|
|
@@ -40162,7 +40167,7 @@ ${codeText}
|
|
|
40162
40167
|
assert(logger$2S, typeof blockIndex === "number", "invalid path blockIndex");
|
|
40163
40168
|
const blockData = editor.doc.getBlockData(containerId, blockIndex);
|
|
40164
40169
|
const length = getTextLength(blockText);
|
|
40165
|
-
const cursorMessages = remoteUsers.getSimpleCursors(blockData.id);
|
|
40170
|
+
const cursorMessages = remoteUsers.getSimpleCursors(blockData.id, editor.doc.getUser().userId);
|
|
40166
40171
|
cursorMessages.forEach((messages, offset) => {
|
|
40167
40172
|
if (offset > length) {
|
|
40168
40173
|
offset = length;
|
|
@@ -41987,7 +41992,7 @@ ${codeText}
|
|
|
41987
41992
|
placement: (_a = options == null ? void 0 : options.placement) != null ? _a : "bottom-start",
|
|
41988
41993
|
maxWidth: (_b = this.options.maxWidth) != null ? _b : 650,
|
|
41989
41994
|
arrow: (_c = options == null ? void 0 : options.arrow) != null ? _c : this.options.tippyArrow,
|
|
41990
|
-
appendTo: document.body,
|
|
41995
|
+
appendTo: this.options.appendTo || target.closest(".command-bar-container") || document.body,
|
|
41991
41996
|
onShow: this.handleShow,
|
|
41992
41997
|
onHidden: this.handleHidden,
|
|
41993
41998
|
onShown: this.handleShown,
|
|
@@ -42553,7 +42558,7 @@ ${codeText}
|
|
|
42553
42558
|
placement: (_a = options == null ? void 0 : options.placement) != null ? _a : "bottom-start",
|
|
42554
42559
|
maxWidth: 500,
|
|
42555
42560
|
arrow: this.options.tippyArrow,
|
|
42556
|
-
appendTo: document.body,
|
|
42561
|
+
appendTo: this.options.appendTo || target.closest(".command-bar-container") || document.body,
|
|
42557
42562
|
onShow: this.handleShow,
|
|
42558
42563
|
onHidden: this.handleHidden,
|
|
42559
42564
|
delay: options == null ? void 0 : options.delay,
|
|
@@ -43163,7 +43168,7 @@ ${codeText}
|
|
|
43163
43168
|
placement: "bottom",
|
|
43164
43169
|
maxWidth: 1e3,
|
|
43165
43170
|
arrow: (_b = options == null ? void 0 : options.arrow) != null ? _b : this.options.tippyArrow,
|
|
43166
|
-
appendTo: document.body,
|
|
43171
|
+
appendTo: this.options.appendTo || target.closest(".command-bar-container") || document.body,
|
|
43167
43172
|
onShow: this.handleShow,
|
|
43168
43173
|
onShown: this.handleShown,
|
|
43169
43174
|
onHidden: this.handleHidden,
|
|
@@ -54589,6 +54594,7 @@ ${codeText}
|
|
|
54589
54594
|
}, 50));
|
|
54590
54595
|
this.editor = editor;
|
|
54591
54596
|
const popover = editor.options.componentsOptions.popover;
|
|
54597
|
+
const objectToolbar = editor.options.componentsOptions.objectToolbar;
|
|
54592
54598
|
this.toolbar = new ManualToolbar([], void 0, {
|
|
54593
54599
|
tooltipId: editor.clientId,
|
|
54594
54600
|
id: "editor-toolbar",
|
|
@@ -54596,7 +54602,8 @@ ${codeText}
|
|
|
54596
54602
|
refuseOverflow: true,
|
|
54597
54603
|
padding: 20,
|
|
54598
54604
|
showName: clientType.isMobile,
|
|
54599
|
-
autoClose: clientType.isMobile ? true : void 0
|
|
54605
|
+
autoClose: clientType.isMobile ? true : void 0,
|
|
54606
|
+
appendTo: (objectToolbar == null ? void 0 : objectToolbar.appendTo) || (popover == null ? void 0 : popover.appendTo)
|
|
54600
54607
|
});
|
|
54601
54608
|
this.toolbar.on("click", this.handleButtonClick);
|
|
54602
54609
|
this.toolbar.on("close", this.handleClose);
|
|
@@ -74544,20 +74551,6 @@ ${codeText}
|
|
|
74544
74551
|
const maxCellTextLength = maxCellTextLengths.get(cell.col) || 0;
|
|
74545
74552
|
return padText(text2, maxCellTextLength);
|
|
74546
74553
|
};
|
|
74547
|
-
if (type === "text") {
|
|
74548
|
-
const text2 = [];
|
|
74549
|
-
for (let col = 0; col < grid.colCount; col++) {
|
|
74550
|
-
const cellText = getCellText({ row: 0, col });
|
|
74551
|
-
text2.push(cellText);
|
|
74552
|
-
}
|
|
74553
|
-
for (let row = 1; row < grid.rowCount; row++) {
|
|
74554
|
-
for (let col = 0; col < grid.colCount; col++) {
|
|
74555
|
-
const cellText = getCellText({ row, col });
|
|
74556
|
-
text2.push(cellText);
|
|
74557
|
-
}
|
|
74558
|
-
}
|
|
74559
|
-
return text2.join("\n");
|
|
74560
|
-
}
|
|
74561
74554
|
const lines = [];
|
|
74562
74555
|
let headerText = "|";
|
|
74563
74556
|
let headerSeparator = "|";
|
|
@@ -94763,6 +94756,294 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
94763
94756
|
}
|
|
94764
94757
|
});
|
|
94765
94758
|
}
|
|
94759
|
+
const CkeImageConverter = {
|
|
94760
|
+
filter: (node) => {
|
|
94761
|
+
if (node.nodeName !== "IMG") {
|
|
94762
|
+
return false;
|
|
94763
|
+
}
|
|
94764
|
+
const elem = node;
|
|
94765
|
+
const refId = elem.getAttribute("data-ref-id");
|
|
94766
|
+
const refType = elem.getAttribute("data-ref-type");
|
|
94767
|
+
const uuid = elem.getAttribute("data-uuid");
|
|
94768
|
+
return Boolean(refType === "task" && refId && uuid);
|
|
94769
|
+
},
|
|
94770
|
+
replacement: (content, node) => {
|
|
94771
|
+
const refType = node.getAttribute("data-ref-type");
|
|
94772
|
+
const refId = node.getAttribute("data-ref-id");
|
|
94773
|
+
const uuid = node.getAttribute("data-uuid");
|
|
94774
|
+
const src = `ones-file:${refType}/${refId}/${uuid}`;
|
|
94775
|
+
return ``;
|
|
94776
|
+
}
|
|
94777
|
+
};
|
|
94778
|
+
const ckeHtmlConverters = /* @__PURE__ */ new Map();
|
|
94779
|
+
function registerCKEHtmlConvert(name, converter) {
|
|
94780
|
+
if (ckeHtmlConverters.has(name)) {
|
|
94781
|
+
return;
|
|
94782
|
+
}
|
|
94783
|
+
ckeHtmlConverters.set(name, converter);
|
|
94784
|
+
turndownService.use((ts) => {
|
|
94785
|
+
ts.addRule(name, converter);
|
|
94786
|
+
});
|
|
94787
|
+
}
|
|
94788
|
+
function getTurndownRootElement(node) {
|
|
94789
|
+
let parent = node;
|
|
94790
|
+
while (parent) {
|
|
94791
|
+
if (parent instanceof HTMLElement && parent.tagName === "BODY") {
|
|
94792
|
+
return parent;
|
|
94793
|
+
}
|
|
94794
|
+
if (!parent.parentNode) {
|
|
94795
|
+
return parent;
|
|
94796
|
+
}
|
|
94797
|
+
parent = parent.parentNode;
|
|
94798
|
+
}
|
|
94799
|
+
return node;
|
|
94800
|
+
}
|
|
94801
|
+
function patchForEmptyBlock(key, node, className) {
|
|
94802
|
+
const root2 = getTurndownRootElement(node);
|
|
94803
|
+
if (root2 && root2 instanceof HTMLElement) {
|
|
94804
|
+
const attributeKey = `data-${key}-processed`;
|
|
94805
|
+
if (!root2.getAttribute(attributeKey)) {
|
|
94806
|
+
root2.setAttribute(attributeKey, "true");
|
|
94807
|
+
const elements = root2.querySelectorAll(className);
|
|
94808
|
+
elements.forEach((elem) => {
|
|
94809
|
+
var _a;
|
|
94810
|
+
const text2 = (_a = elem.textContent) == null ? void 0 : _a.trim();
|
|
94811
|
+
if (!text2) {
|
|
94812
|
+
elem.innerText = "--temp-data--";
|
|
94813
|
+
}
|
|
94814
|
+
});
|
|
94815
|
+
}
|
|
94816
|
+
}
|
|
94817
|
+
}
|
|
94818
|
+
const CkeCommentConverter = {
|
|
94819
|
+
filter: (node) => {
|
|
94820
|
+
if (node.nodeName === "SPAN") {
|
|
94821
|
+
const span = node;
|
|
94822
|
+
const ref = span.getAttribute("data-annotate-ref");
|
|
94823
|
+
return Boolean(ref);
|
|
94824
|
+
}
|
|
94825
|
+
return false;
|
|
94826
|
+
},
|
|
94827
|
+
replacement: (content, node) => {
|
|
94828
|
+
var _a;
|
|
94829
|
+
const span = node;
|
|
94830
|
+
const ref = span.getAttribute("data-annotate-ref");
|
|
94831
|
+
const text2 = (_a = span.textContent) != null ? _a : "";
|
|
94832
|
+
return `[${text2}](comment://${ref})`;
|
|
94833
|
+
}
|
|
94834
|
+
};
|
|
94835
|
+
function processCkeCommentsLink(doc2) {
|
|
94836
|
+
const containers = doc2.blocks;
|
|
94837
|
+
Object.values(containers).forEach((blocks) => {
|
|
94838
|
+
blocks.forEach((block) => {
|
|
94839
|
+
const text2 = block.text;
|
|
94840
|
+
if (text2) {
|
|
94841
|
+
text2.forEach((op) => {
|
|
94842
|
+
if (op.attributes) {
|
|
94843
|
+
const attributes = op.attributes;
|
|
94844
|
+
const link2 = attributes.link;
|
|
94845
|
+
if (link2 == null ? void 0 : link2.startsWith("comment://")) {
|
|
94846
|
+
delete attributes.link;
|
|
94847
|
+
const commentId = link2.replace("comment://", "");
|
|
94848
|
+
const key = `comment-${commentId.toLocaleLowerCase()}`;
|
|
94849
|
+
attributes[key] = commentId;
|
|
94850
|
+
}
|
|
94851
|
+
}
|
|
94852
|
+
});
|
|
94853
|
+
}
|
|
94854
|
+
});
|
|
94855
|
+
});
|
|
94856
|
+
}
|
|
94857
|
+
const CkeMentionConverter = {
|
|
94858
|
+
filter: (node) => {
|
|
94859
|
+
patchForEmptyBlock("mention", node, ".ones-at-user-block");
|
|
94860
|
+
if (node.nodeName === "SPAN") {
|
|
94861
|
+
const span = node;
|
|
94862
|
+
if (hasClass(span, "ones-at-user-block")) {
|
|
94863
|
+
const name = span.getAttribute("data-default-name");
|
|
94864
|
+
const refId = span.getAttribute("data-ref-id");
|
|
94865
|
+
return Boolean(name) && Boolean(refId);
|
|
94866
|
+
}
|
|
94867
|
+
}
|
|
94868
|
+
return false;
|
|
94869
|
+
},
|
|
94870
|
+
replacement: (content, node) => {
|
|
94871
|
+
const span = node;
|
|
94872
|
+
const name = span.getAttribute("data-default-name") || "";
|
|
94873
|
+
const refId = span.getAttribute("data-ref-id") || "";
|
|
94874
|
+
if (name && refId) {
|
|
94875
|
+
const box = {
|
|
94876
|
+
id: genId(),
|
|
94877
|
+
type: "mention",
|
|
94878
|
+
box: true,
|
|
94879
|
+
created: Date.now(),
|
|
94880
|
+
iconUrl: "",
|
|
94881
|
+
text: name,
|
|
94882
|
+
mentionId: refId
|
|
94883
|
+
};
|
|
94884
|
+
const text2 = [
|
|
94885
|
+
{
|
|
94886
|
+
insert: " ",
|
|
94887
|
+
attributes: box
|
|
94888
|
+
}
|
|
94889
|
+
];
|
|
94890
|
+
const obj = {
|
|
94891
|
+
text: text2
|
|
94892
|
+
};
|
|
94893
|
+
const base64 = toBase64URL(JSON.stringify(obj));
|
|
94894
|
+
return `[[${base64}]]`;
|
|
94895
|
+
}
|
|
94896
|
+
return name;
|
|
94897
|
+
}
|
|
94898
|
+
};
|
|
94899
|
+
function convertMentionToCkeMention(editor, boxData, doc2, type) {
|
|
94900
|
+
const data2 = boxData;
|
|
94901
|
+
if (type === "html") {
|
|
94902
|
+
return `<ones-at-user data-ref-name="${data2.text}" data-ref-id="${data2.mentionId}" data-default-name="${data2.text}" class="ones-at-user-block" data-viewer="1"><span>@${data2.text}</span></ones-at-user>`;
|
|
94903
|
+
}
|
|
94904
|
+
return `@${data2.text}`;
|
|
94905
|
+
}
|
|
94906
|
+
function patchMentionConverter(editor) {
|
|
94907
|
+
const mentionBox = editor.editorBoxes.getBoxClass("mention");
|
|
94908
|
+
if (mentionBox) {
|
|
94909
|
+
const oldConvertTo = mentionBox.convertTo;
|
|
94910
|
+
if (oldConvertTo !== convertMentionToCkeMention) {
|
|
94911
|
+
mentionBox.convertTo = convertMentionToCkeMention;
|
|
94912
|
+
}
|
|
94913
|
+
}
|
|
94914
|
+
}
|
|
94915
|
+
function processLinks(doc2) {
|
|
94916
|
+
const containers = doc2.blocks;
|
|
94917
|
+
Object.values(containers).forEach((blocks) => {
|
|
94918
|
+
blocks.forEach((block) => {
|
|
94919
|
+
if (block.text) {
|
|
94920
|
+
const text2 = block.text;
|
|
94921
|
+
text2.forEach((op) => {
|
|
94922
|
+
const attributes = op.attributes;
|
|
94923
|
+
if (attributes) {
|
|
94924
|
+
attributes.link;
|
|
94925
|
+
}
|
|
94926
|
+
});
|
|
94927
|
+
}
|
|
94928
|
+
});
|
|
94929
|
+
});
|
|
94930
|
+
}
|
|
94931
|
+
const CkeMarkdownConverter = {
|
|
94932
|
+
filter: (node) => {
|
|
94933
|
+
if (node.nodeName !== "DIV") {
|
|
94934
|
+
return false;
|
|
94935
|
+
}
|
|
94936
|
+
const div = node;
|
|
94937
|
+
return hasClass(div, "ones-marked-card");
|
|
94938
|
+
},
|
|
94939
|
+
replacement: (content, node) => {
|
|
94940
|
+
const textToCodeBlock2 = (text2, language) => {
|
|
94941
|
+
const codeBlocks = text2.split("\n").map((line) => {
|
|
94942
|
+
const block = {
|
|
94943
|
+
type: "text",
|
|
94944
|
+
id: genId(),
|
|
94945
|
+
text: createRichText(line)
|
|
94946
|
+
};
|
|
94947
|
+
return block;
|
|
94948
|
+
});
|
|
94949
|
+
const containerId = genId();
|
|
94950
|
+
const doc22 = {
|
|
94951
|
+
blocks: {
|
|
94952
|
+
root: [
|
|
94953
|
+
{
|
|
94954
|
+
id: genId(),
|
|
94955
|
+
type: "code",
|
|
94956
|
+
language,
|
|
94957
|
+
children: [containerId]
|
|
94958
|
+
}
|
|
94959
|
+
],
|
|
94960
|
+
[containerId]: codeBlocks
|
|
94961
|
+
},
|
|
94962
|
+
meta: {},
|
|
94963
|
+
comments: {}
|
|
94964
|
+
};
|
|
94965
|
+
return toBase64URL(JSON.stringify(doc22));
|
|
94966
|
+
};
|
|
94967
|
+
const nodeToCodeBlock2 = (node2, lang) => {
|
|
94968
|
+
const text2 = node2.textContent || "";
|
|
94969
|
+
return textToCodeBlock2(text2, lang);
|
|
94970
|
+
};
|
|
94971
|
+
const doc2 = nodeToCodeBlock2(node, "markdown");
|
|
94972
|
+
const fence = "```";
|
|
94973
|
+
return "\n\n" + fence + "\n" + doc2 + "\n" + fence + "\n\n";
|
|
94974
|
+
}
|
|
94975
|
+
};
|
|
94976
|
+
registerCKEHtmlConvert("image", CkeImageConverter);
|
|
94977
|
+
registerCKEHtmlConvert("comment", CkeCommentConverter);
|
|
94978
|
+
registerCKEHtmlConvert("mention", CkeMentionConverter);
|
|
94979
|
+
registerCKEHtmlConvert("markdown", CkeMarkdownConverter);
|
|
94980
|
+
function ckeHtml2Doc(html) {
|
|
94981
|
+
const doc2 = htmlToDoc(html) || createEmptyDoc$1();
|
|
94982
|
+
processCkeCommentsLink(doc2);
|
|
94983
|
+
processLinks(doc2);
|
|
94984
|
+
return doc2;
|
|
94985
|
+
}
|
|
94986
|
+
function injectDocToCkeHtmlFragment(htmlFragment, doc2, text2) {
|
|
94987
|
+
const meta = `<meta charset="utf-8"><ones-editor-doc data-source="ones-editor-doc::${toBase64URL(
|
|
94988
|
+
JSON.stringify(doc2)
|
|
94989
|
+
)}::ones-editor-doc" />`;
|
|
94990
|
+
let textMeta = "";
|
|
94991
|
+
if (text2) {
|
|
94992
|
+
textMeta = `<meta name="ones-editor-text" content="${toBase64URL(text2)}" />`;
|
|
94993
|
+
}
|
|
94994
|
+
const html = `<!doctype html><html><head>${meta}${textMeta}</head><body>${htmlFragment}</body></html>`;
|
|
94995
|
+
return html;
|
|
94996
|
+
}
|
|
94997
|
+
function editorToCKEHtml(editor) {
|
|
94998
|
+
patchMentionConverter(editor);
|
|
94999
|
+
const docObject = editor.doc.toJSON();
|
|
95000
|
+
if (isEmptyDoc(docObject)) {
|
|
95001
|
+
return "";
|
|
95002
|
+
}
|
|
95003
|
+
let html = docToHtmlFragment(editor, docObject);
|
|
95004
|
+
const text2 = docToText(editor, docObject);
|
|
95005
|
+
html = injectDocToCkeHtmlFragment(html, docObject, text2);
|
|
95006
|
+
return html;
|
|
95007
|
+
}
|
|
95008
|
+
function combineDoc(doc1, doc2) {
|
|
95009
|
+
if (isEmptyDoc(doc1)) {
|
|
95010
|
+
return doc2;
|
|
95011
|
+
}
|
|
95012
|
+
if (isEmptyDoc(doc2)) {
|
|
95013
|
+
return doc1;
|
|
95014
|
+
}
|
|
95015
|
+
const splitterDoc = createEmptyDoc$1("", {
|
|
95016
|
+
firstLineAsTitle: false
|
|
95017
|
+
});
|
|
95018
|
+
return mergeDocs([doc1, splitterDoc, doc2]);
|
|
95019
|
+
}
|
|
95020
|
+
function mergeHTMLBodiesOnly(htmlA, htmlB) {
|
|
95021
|
+
const parser = new DOMParser();
|
|
95022
|
+
const docA = parser.parseFromString(htmlA, "text/html");
|
|
95023
|
+
const docB = parser.parseFromString(htmlB, "text/html");
|
|
95024
|
+
const mergedDoc = document.implementation.createHTMLDocument("Merged");
|
|
95025
|
+
const bodyA = docA.body;
|
|
95026
|
+
const bodyB = docB.body;
|
|
95027
|
+
const mergedBody = mergedDoc.body;
|
|
95028
|
+
Array.from(bodyA.childNodes).forEach((node) => {
|
|
95029
|
+
mergedBody.appendChild(mergedDoc.importNode(node, true));
|
|
95030
|
+
});
|
|
95031
|
+
Array.from(bodyB.childNodes).forEach((node) => {
|
|
95032
|
+
mergedBody.appendChild(mergedDoc.importNode(node, true));
|
|
95033
|
+
});
|
|
95034
|
+
return mergedBody.innerHTML;
|
|
95035
|
+
}
|
|
95036
|
+
function combineCkeHtml(html1, html2) {
|
|
95037
|
+
const doc1 = ckeHtml2Doc(html1);
|
|
95038
|
+
const doc2 = ckeHtml2Doc(html2);
|
|
95039
|
+
const newDoc = combineDoc(doc1, doc2);
|
|
95040
|
+
const newHtml = mergeHTMLBodiesOnly(html1, html2);
|
|
95041
|
+
const ret = injectDocToCkeHtmlFragment(newHtml, newDoc);
|
|
95042
|
+
return ret;
|
|
95043
|
+
}
|
|
95044
|
+
function combineRichTextValue(value1, value2) {
|
|
95045
|
+
return combineCkeHtml(value1, value2);
|
|
95046
|
+
}
|
|
94766
95047
|
const logger = getLogger("create-editor");
|
|
94767
95048
|
function getHooks(options, local) {
|
|
94768
95049
|
var _a;
|
|
@@ -95021,7 +95302,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
95021
95302
|
}
|
|
95022
95303
|
}
|
|
95023
95304
|
});
|
|
95024
|
-
editor.version = "2.9.8-beta.
|
|
95305
|
+
editor.version = "2.9.8-beta.10";
|
|
95025
95306
|
return editor;
|
|
95026
95307
|
}
|
|
95027
95308
|
function isDoc(doc2) {
|
|
@@ -95153,7 +95434,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
95153
95434
|
OnesEditorDropTarget.register(editor);
|
|
95154
95435
|
OnesEditorTocProvider.register(editor);
|
|
95155
95436
|
OnesEditorExclusiveBlock.register(editor);
|
|
95156
|
-
editor.version = "2.9.8-beta.
|
|
95437
|
+
editor.version = "2.9.8-beta.10";
|
|
95157
95438
|
return editor;
|
|
95158
95439
|
}
|
|
95159
95440
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -141255,12 +141536,15 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
141255
141536
|
exports2.blockToText = blockToText;
|
|
141256
141537
|
exports2.blocksToDoc = blocksToDoc;
|
|
141257
141538
|
exports2.changeButtonName = changeButtonName;
|
|
141539
|
+
exports2.ckeHtml2Doc = ckeHtml2Doc;
|
|
141258
141540
|
exports2.clearAllSelection = clearAllSelection;
|
|
141259
141541
|
exports2.clientType = clientType;
|
|
141260
141542
|
exports2.cloneBlock = cloneBlock;
|
|
141261
141543
|
exports2.cloneChildContainer = cloneChildContainer;
|
|
141262
141544
|
exports2.cloneDoc = cloneDoc;
|
|
141263
141545
|
exports2.cloneText = cloneText;
|
|
141546
|
+
exports2.combineCkeHtml = combineCkeHtml;
|
|
141547
|
+
exports2.combineRichTextValue = combineRichTextValue;
|
|
141264
141548
|
exports2.commentToShareDbComment = commentToShareDbComment;
|
|
141265
141549
|
exports2.compareElement = compareElement;
|
|
141266
141550
|
exports2.comparePosition = comparePosition;
|
|
@@ -141416,6 +141700,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
141416
141700
|
exports2.editorSelectWordLeft = editorSelectWordLeft;
|
|
141417
141701
|
exports2.editorSetTextColor = editorSetTextColor;
|
|
141418
141702
|
exports2.editorShowFindDialog = editorShowFindDialog;
|
|
141703
|
+
exports2.editorToCKEHtml = editorToCKEHtml;
|
|
141419
141704
|
exports2.editorToDocx = editorToDocx;
|
|
141420
141705
|
exports2.editorUpdateBlockData = editorUpdateBlockData;
|
|
141421
141706
|
exports2.editorUpdateCompositionText = editorUpdateCompositionText;
|
|
@@ -141582,6 +141867,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
141582
141867
|
exports2.i18n = i18n$1;
|
|
141583
141868
|
exports2.includeBigTable = includeBigTable;
|
|
141584
141869
|
exports2.injectBlockOptions = injectBlockOptions;
|
|
141870
|
+
exports2.injectDocToCkeHtmlFragment = injectDocToCkeHtmlFragment;
|
|
141585
141871
|
exports2.injectDocToHtmlFragment = injectDocToHtmlFragment;
|
|
141586
141872
|
exports2.injectSource = injectSource;
|
|
141587
141873
|
exports2.injectStyle = injectStyle;
|