@ones-editor/editor 2.2.15-beta.1 → 2.2.15-beta.2
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/callout-block/src/callout-block/callout-block-content.d.ts +3 -2
- package/@ones-editor/callout-block/src/callout-block/callout-icon.d.ts +4 -9
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui-base/src/emoji-palette/index.d.ts +1 -1
- package/dist/index.js +81 -60
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@ export declare class EmojiPalette extends TypedEmitter<EmojiPaletteEvents> imple
|
|
|
14
14
|
private unmountPalette;
|
|
15
15
|
constructor(editor: OnesEditor);
|
|
16
16
|
private renderPalette;
|
|
17
|
-
render(): void
|
|
17
|
+
render(): Promise<void>;
|
|
18
18
|
setCurrentEmoji(emoji: string): void;
|
|
19
19
|
destroy(): void;
|
|
20
20
|
}
|
package/dist/index.js
CHANGED
|
@@ -6596,7 +6596,7 @@ div[data-command-bar-id=mobile-bottom-menu] .mobile-menu-wrap.editor-mention .co
|
|
|
6596
6596
|
padding: 10px;
|
|
6597
6597
|
border-radius: 3px;
|
|
6598
6598
|
}
|
|
6599
|
-
.editor-root [data-type=editor-container].root div[data-type=editor-block].callout-block .callout-root .callout-icon {
|
|
6599
|
+
.editor-root [data-type=editor-container].root div[data-type=editor-block].callout-block .callout-root .callout-icon-inner {
|
|
6600
6600
|
cursor: pointer;
|
|
6601
6601
|
display: flex;
|
|
6602
6602
|
align-items: center;
|
|
@@ -6609,7 +6609,7 @@ div[data-command-bar-id=mobile-bottom-menu] .mobile-menu-wrap.editor-mention .co
|
|
|
6609
6609
|
line-height: 1;
|
|
6610
6610
|
font-family: Apple Color Emoji, Segoe UI Emoji, NotoColorEmoji, Noto Color Emoji, Segoe UI Symbol, Android Emoji, EmojiSymbols;
|
|
6611
6611
|
}
|
|
6612
|
-
.editor-root [data-type=editor-container].root div[data-type=editor-block].callout-block .callout-root .callout-icon:hover {
|
|
6612
|
+
.editor-root [data-type=editor-container].root div[data-type=editor-block].callout-block .callout-root .callout-icon-inner:hover {
|
|
6613
6613
|
border-radius: 3px;
|
|
6614
6614
|
background-color: rgba(0, 36, 90, 0.04);
|
|
6615
6615
|
}
|
|
@@ -42938,8 +42938,9 @@ ${codeText}
|
|
|
42938
42938
|
const element = createElement("div", ["emoji-palette"], null);
|
|
42939
42939
|
this.element = element;
|
|
42940
42940
|
}
|
|
42941
|
-
renderPalette() {
|
|
42941
|
+
async renderPalette() {
|
|
42942
42942
|
var _a;
|
|
42943
|
+
this.element.innerHTML = "";
|
|
42943
42944
|
const emojiPaletteOptions = this.editor.getComponentOptions("emojiPalette");
|
|
42944
42945
|
const paletteRenderer = (_a = emojiPaletteOptions == null ? void 0 : emojiPaletteOptions.emojiPaletteRenderer) != null ? _a : defaultPaletteRenderer;
|
|
42945
42946
|
const handleSelectEmoji = (emoji) => {
|
|
@@ -42949,10 +42950,10 @@ ${codeText}
|
|
|
42949
42950
|
emoji: this.currentEmoji,
|
|
42950
42951
|
onSelectEmoji: handleSelectEmoji
|
|
42951
42952
|
};
|
|
42952
|
-
return paletteRenderer(this.element, options);
|
|
42953
|
+
return Promise.resolve().then(() => paletteRenderer(this.element, options));
|
|
42953
42954
|
}
|
|
42954
|
-
render() {
|
|
42955
|
-
this.unmountPalette = this.renderPalette();
|
|
42955
|
+
async render() {
|
|
42956
|
+
this.unmountPalette = await this.renderPalette();
|
|
42956
42957
|
}
|
|
42957
42958
|
setCurrentEmoji(emoji) {
|
|
42958
42959
|
this.currentEmoji = emoji;
|
|
@@ -80731,6 +80732,7 @@ ${content}
|
|
|
80731
80732
|
editor.updateBlockData(block, blockPayload, void 0, {
|
|
80732
80733
|
noScroll: true
|
|
80733
80734
|
});
|
|
80735
|
+
CalloutLastUpdateData.init(editor).update(blockPayload);
|
|
80734
80736
|
}
|
|
80735
80737
|
getLogger("callout-block-commands");
|
|
80736
80738
|
class CalloutBlockCommands {
|
|
@@ -80796,7 +80798,6 @@ ${content}
|
|
|
80796
80798
|
}
|
|
80797
80799
|
updateCalloutBlockData(blockPayload) {
|
|
80798
80800
|
updateCalloutBlockData(this.editor, this.activeBlock, blockPayload);
|
|
80799
|
-
CalloutLastUpdateData.init(this.editor).update(blockPayload);
|
|
80800
80801
|
}
|
|
80801
80802
|
createPresetItem(presetId) {
|
|
80802
80803
|
return createPresetItem(presetId, this.editor, this.activeBlock);
|
|
@@ -80841,21 +80842,29 @@ ${content}
|
|
|
80841
80842
|
}
|
|
80842
80843
|
class EmojiPopup {
|
|
80843
80844
|
constructor(editor) {
|
|
80845
|
+
__publicField(this, "popup");
|
|
80846
|
+
__publicField(this, "popupContent");
|
|
80847
|
+
__publicField(this, "emojiPalette");
|
|
80848
|
+
__publicField(this, "handlePopupClose", () => {
|
|
80849
|
+
this.emojiPalette.destroy();
|
|
80850
|
+
});
|
|
80844
80851
|
this.editor = editor;
|
|
80845
|
-
|
|
80846
|
-
|
|
80847
|
-
const { emoji, onSelectEmoji } = options;
|
|
80848
|
-
const emojiPalette = new EmojiPalette(this.editor);
|
|
80849
|
-
emojiPalette.setCurrentEmoji(emoji);
|
|
80850
|
-
emojiPalette.render();
|
|
80851
|
-
emojiPalette.addListener("onSelectEmoji", onSelectEmoji);
|
|
80852
|
-
return emojiPalette.element;
|
|
80853
|
-
}
|
|
80854
|
-
show(rect, options) {
|
|
80855
|
-
const popup = new Popup(this.createEmojiPopupContent(options), {
|
|
80852
|
+
this.popupContent = createElement("div", ["emoji-popup-content"], null);
|
|
80853
|
+
this.popup = new Popup(this.popupContent, {
|
|
80856
80854
|
id: "emoji-popup"
|
|
80857
80855
|
});
|
|
80858
|
-
popup.
|
|
80856
|
+
this.popup.on("close", this.handlePopupClose);
|
|
80857
|
+
const emojiPalette = new EmojiPalette(this.editor);
|
|
80858
|
+
this.emojiPalette = emojiPalette;
|
|
80859
|
+
}
|
|
80860
|
+
populateEmojiPopupContent() {
|
|
80861
|
+
this.popupContent.innerHTML = "";
|
|
80862
|
+
this.emojiPalette.render();
|
|
80863
|
+
this.popupContent.appendChild(this.emojiPalette.element);
|
|
80864
|
+
}
|
|
80865
|
+
show(rect) {
|
|
80866
|
+
this.populateEmojiPopupContent();
|
|
80867
|
+
this.popup.manualShow(document.body, {
|
|
80859
80868
|
theme: "light",
|
|
80860
80869
|
placement: "bottom-start",
|
|
80861
80870
|
offset: [0, 5],
|
|
@@ -80864,74 +80873,85 @@ ${content}
|
|
|
80864
80873
|
}
|
|
80865
80874
|
destroy() {
|
|
80866
80875
|
}
|
|
80867
|
-
static get(editor) {
|
|
80868
|
-
return editor.addCustom(
|
|
80876
|
+
static get(editor, blockId) {
|
|
80877
|
+
return editor.addCustom(`emoji-popup-${blockId}`, (editor2) => new EmojiPopup(editor2));
|
|
80869
80878
|
}
|
|
80870
80879
|
}
|
|
80871
80880
|
class CalloutIcon {
|
|
80872
|
-
constructor(editor,
|
|
80881
|
+
constructor(editor, blockId) {
|
|
80873
80882
|
__publicField(this, "iconElement");
|
|
80883
|
+
__publicField(this, "emojiPopup");
|
|
80874
80884
|
__publicField(this, "handleSelectEmoji", (emoji) => {
|
|
80875
|
-
const calloutBlock = this.editor.getBlockById(this.
|
|
80876
|
-
updateCalloutBlockData(this.editor, calloutBlock, {
|
|
80877
|
-
icon: emoji
|
|
80878
|
-
});
|
|
80885
|
+
const calloutBlock = this.editor.getBlockById(this.blockId);
|
|
80886
|
+
updateCalloutBlockData(this.editor, calloutBlock, { icon: emoji });
|
|
80879
80887
|
});
|
|
80880
80888
|
__publicField(this, "handleIconClick", () => {
|
|
80881
|
-
const
|
|
80882
|
-
const
|
|
80889
|
+
const calloutBlock = this.editor.getBlockById(this.blockId);
|
|
80890
|
+
const blockData = getCalloutBlockData(this.editor, calloutBlock);
|
|
80891
|
+
const { icon } = blockData;
|
|
80892
|
+
this.emojiPopup.emojiPalette.setCurrentEmoji(icon);
|
|
80883
80893
|
const rect = this.iconElement.getBoundingClientRect();
|
|
80884
|
-
emojiPopup.show(rect
|
|
80885
|
-
emoji: icon,
|
|
80886
|
-
onSelectEmoji: (emoji) => {
|
|
80887
|
-
const calloutBlock = this.editor.getBlockById(blockId);
|
|
80888
|
-
updateCalloutBlockData(this.editor, calloutBlock, {
|
|
80889
|
-
icon: emoji
|
|
80890
|
-
});
|
|
80891
|
-
}
|
|
80892
|
-
});
|
|
80894
|
+
this.emojiPopup.show(rect);
|
|
80893
80895
|
});
|
|
80894
80896
|
this.editor = editor;
|
|
80895
|
-
this.
|
|
80896
|
-
const
|
|
80897
|
-
const calloutIcon = createElement("div", ["callout-icon"], parent);
|
|
80897
|
+
this.blockId = blockId;
|
|
80898
|
+
const calloutIcon = createElement("div", ["callout-icon"], null);
|
|
80898
80899
|
this.iconElement = calloutIcon;
|
|
80899
80900
|
calloutIcon.setAttribute("data-editor-tooltip-common", i18n$1.t("callout.icon.toggleIcon"));
|
|
80900
|
-
this.updateIcon(icon);
|
|
80901
|
-
this.bindEvent();
|
|
80902
|
-
}
|
|
80903
|
-
bindEvent() {
|
|
80904
80901
|
this.editor.domEvents.addEventListener(this.iconElement, "click", this.handleIconClick);
|
|
80902
|
+
this.emojiPopup = EmojiPopup.get(this.editor, blockId);
|
|
80903
|
+
this.emojiPopup.emojiPalette.on("onSelectEmoji", this.handleSelectEmoji);
|
|
80904
|
+
}
|
|
80905
|
+
render(parent, icon) {
|
|
80906
|
+
this.updateIcon(icon);
|
|
80907
|
+
parent.appendChild(this.iconElement);
|
|
80905
80908
|
}
|
|
80906
80909
|
updateIcon(icon) {
|
|
80907
|
-
const
|
|
80908
|
-
|
|
80910
|
+
const calloutIcon = this.iconElement;
|
|
80911
|
+
calloutIcon.innerHTML = "";
|
|
80912
|
+
if (icon) {
|
|
80913
|
+
const calloutIconInner = createElement("div", ["callout-icon-inner"], calloutIcon);
|
|
80914
|
+
const displayIcon = isPresetId(icon) ? getPresetIcon(icon) : icon;
|
|
80915
|
+
calloutIconInner.innerHTML = displayIcon;
|
|
80916
|
+
calloutIcon.appendChild(calloutIconInner);
|
|
80917
|
+
}
|
|
80909
80918
|
}
|
|
80910
80919
|
destroy() {
|
|
80911
80920
|
}
|
|
80912
|
-
static
|
|
80913
|
-
return new CalloutIcon(editor,
|
|
80921
|
+
static get(editor, blockId) {
|
|
80922
|
+
return editor.addCustom(`callout-icon-${blockId}`, () => new CalloutIcon(editor, blockId));
|
|
80914
80923
|
}
|
|
80915
80924
|
}
|
|
80916
80925
|
getLogger("callout-root-dom");
|
|
80926
|
+
function updateCalloutRoot(blockContent, payload) {
|
|
80927
|
+
const calloutRoot = blockContent.querySelector(".callout-root");
|
|
80928
|
+
setDataset(calloutRoot, payload);
|
|
80929
|
+
}
|
|
80917
80930
|
function createCalloutBlockContent(editor, path, blockElement, blockData) {
|
|
80918
80931
|
const { icon, backgroundColor, children, id } = blockData;
|
|
80919
80932
|
const blockContent = createBlockContentElement(blockElement, "div");
|
|
80920
|
-
const calloutRoot = createElement("div", ["callout-root"], blockContent
|
|
80921
|
-
|
|
80922
|
-
backgroundColor
|
|
80933
|
+
const calloutRoot = createElement("div", ["callout-root"], blockContent);
|
|
80934
|
+
updateCalloutRoot(blockContent, {
|
|
80935
|
+
backgroundColor,
|
|
80936
|
+
icon
|
|
80923
80937
|
});
|
|
80924
|
-
|
|
80925
|
-
|
|
80926
|
-
blockId: id,
|
|
80927
|
-
icon,
|
|
80928
|
-
parent: calloutRoot
|
|
80929
|
-
});
|
|
80930
|
-
}
|
|
80938
|
+
const calloutIcon = CalloutIcon.get(editor, id);
|
|
80939
|
+
calloutIcon.render(calloutRoot, icon);
|
|
80931
80940
|
const calloutContent = createElement("div", ["callout-content"], calloutRoot);
|
|
80932
80941
|
editor.createChildContainer(path, calloutContent, children[0]);
|
|
80933
80942
|
return blockContent;
|
|
80934
80943
|
}
|
|
80944
|
+
function handleUpdateCalloutBlock(editor, block, blockData) {
|
|
80945
|
+
const { icon, backgroundColor, id } = blockData;
|
|
80946
|
+
const blockContent = getBlockContent(block);
|
|
80947
|
+
updateCalloutRoot(blockContent, {
|
|
80948
|
+
backgroundColor,
|
|
80949
|
+
icon
|
|
80950
|
+
});
|
|
80951
|
+
const calloutIcon = CalloutIcon.get(editor, id);
|
|
80952
|
+
calloutIcon.updateIcon(icon);
|
|
80953
|
+
return true;
|
|
80954
|
+
}
|
|
80935
80955
|
class CalloutQuickMenuItemFilter {
|
|
80936
80956
|
constructor(editor) {
|
|
80937
80957
|
setTimeout(() => {
|
|
@@ -81180,6 +81200,7 @@ ${content}
|
|
|
81180
81200
|
getRangeFromPoint: getRangeFromPoint$1,
|
|
81181
81201
|
getBlockTextLength: getBlockTextLength$1,
|
|
81182
81202
|
createBlockContent: createBlockContent$1,
|
|
81203
|
+
handleUpdateBlock: handleUpdateCalloutBlock,
|
|
81183
81204
|
moveCaret: moveCaret$1,
|
|
81184
81205
|
getCaretRect: getCaretRect$1,
|
|
81185
81206
|
updateSelection: updateSelection$1,
|
|
@@ -88422,7 +88443,7 @@ ${data2.flowchartText}
|
|
|
88422
88443
|
}
|
|
88423
88444
|
}
|
|
88424
88445
|
});
|
|
88425
|
-
editor.version = "2.2.15-beta.
|
|
88446
|
+
editor.version = "2.2.15-beta.2";
|
|
88426
88447
|
return editor;
|
|
88427
88448
|
}
|
|
88428
88449
|
function isDoc(doc2) {
|
|
@@ -88517,7 +88538,7 @@ ${data2.flowchartText}
|
|
|
88517
88538
|
});
|
|
88518
88539
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
88519
88540
|
OnesEditorToolbar.register(editor);
|
|
88520
|
-
editor.version = "2.2.15-beta.
|
|
88541
|
+
editor.version = "2.2.15-beta.2";
|
|
88521
88542
|
return editor;
|
|
88522
88543
|
}
|
|
88523
88544
|
async function showDocVersions(editor, options, serverUrl) {
|