@ones-editor/editor 2.0.7-beta.22 → 2.0.7-beta.24
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.
|
@@ -31,6 +31,7 @@ export default class OnesEditorToolbar implements OnesEditorHoveringBlockFilter,
|
|
|
31
31
|
private handleHoveringBlockChildChange;
|
|
32
32
|
handleSelectionChange: import("lodash").DebouncedFunc<(editor: OnesEditor) => void>;
|
|
33
33
|
updateItems(updater: (items: CommandItem[]) => CommandItem[]): void;
|
|
34
|
+
updateItemStates(id: CommandItem['id'], states: Required<CommandItem>['states']): void;
|
|
34
35
|
update(reason: ShowToolbarReason): void;
|
|
35
36
|
private showTextToolbar;
|
|
36
37
|
private showObjectToolbar;
|
package/dist/index.js
CHANGED
|
@@ -48126,6 +48126,27 @@ ${codeText}
|
|
|
48126
48126
|
const updatedItems = updater(this.toolbar.items);
|
|
48127
48127
|
this.toolbar.updateItems(updatedItems);
|
|
48128
48128
|
}
|
|
48129
|
+
updateItemStates(id, states) {
|
|
48130
|
+
var _a;
|
|
48131
|
+
const commandItem = this.toolbar.getItemById(id);
|
|
48132
|
+
commandItem.states = states;
|
|
48133
|
+
if (commandItem.element)
|
|
48134
|
+
return;
|
|
48135
|
+
const button2 = (_a = this.toolbar.popper) == null ? void 0 : _a.querySelector(`[data-button-id=${id}]`);
|
|
48136
|
+
if (!button2)
|
|
48137
|
+
return;
|
|
48138
|
+
if (states.indexOf("checked") !== -1) {
|
|
48139
|
+
addClass(button2, "checked");
|
|
48140
|
+
} else {
|
|
48141
|
+
removeClass(button2, "checked");
|
|
48142
|
+
}
|
|
48143
|
+
if (states.indexOf("disabled") !== -1) {
|
|
48144
|
+
button2.setAttribute("disabled", "");
|
|
48145
|
+
} else {
|
|
48146
|
+
button2.removeAttribute("disabled");
|
|
48147
|
+
removeClass(button2, "disabled");
|
|
48148
|
+
}
|
|
48149
|
+
}
|
|
48129
48150
|
update(reason) {
|
|
48130
48151
|
if (!this.editor.isWritable()) {
|
|
48131
48152
|
return;
|
|
@@ -80068,6 +80089,13 @@ ${data2.flowchartText}
|
|
|
80068
80089
|
states
|
|
80069
80090
|
};
|
|
80070
80091
|
}
|
|
80092
|
+
function updateDeleteIconStatus(editor, block) {
|
|
80093
|
+
const states = [];
|
|
80094
|
+
if (isEmptyIcon(editor, block)) {
|
|
80095
|
+
states.push("disabled");
|
|
80096
|
+
}
|
|
80097
|
+
OnesEditorToolbar.get(editor).updateItemStates("delete-icon", states);
|
|
80098
|
+
}
|
|
80071
80099
|
getLogger("callout-block-commands");
|
|
80072
80100
|
class CalloutBlockCommands {
|
|
80073
80101
|
constructor(editor, block) {
|
|
@@ -80094,6 +80122,7 @@ ${data2.flowchartText}
|
|
|
80094
80122
|
this.updateCalloutBlockData({
|
|
80095
80123
|
icon: emoji
|
|
80096
80124
|
});
|
|
80125
|
+
updateDeleteIconStatus(this.editor, this.activeBlock);
|
|
80097
80126
|
});
|
|
80098
80127
|
__publicField(this, "handleEmojiDelete", () => {
|
|
80099
80128
|
this.updateCalloutBlockData({
|
|
@@ -82177,6 +82206,7 @@ ${data2.flowchartText}
|
|
|
82177
82206
|
onMaxUsersError: options.onMaxUsersError
|
|
82178
82207
|
};
|
|
82179
82208
|
const doc2 = await ShareDBDoc.load(docOptions);
|
|
82209
|
+
const enableComments = options == null ? void 0 : options.enableComments;
|
|
82180
82210
|
const editor = createEditor(root2, doc2, {
|
|
82181
82211
|
id: options.id,
|
|
82182
82212
|
scrollContainer: options == null ? void 0 : options.scrollContainer,
|
|
@@ -82190,7 +82220,11 @@ ${data2.flowchartText}
|
|
|
82190
82220
|
decorators: [new CodeTextDecorator(), new RemoteCaretsDecorator()],
|
|
82191
82221
|
insertions: [RemoteCaretsInsertion],
|
|
82192
82222
|
blockHooks: [new BlockLockerHook(), new BlockExclusiveHook(), ...((_f = options.components) == null ? void 0 : _f.blockHooks) || []],
|
|
82193
|
-
textRenders: [
|
|
82223
|
+
textRenders: [
|
|
82224
|
+
enableComments && new OnesEditorCommentsRender(),
|
|
82225
|
+
new BlockPaddingRender(),
|
|
82226
|
+
...((_g = options.components) == null ? void 0 : _g.textRenders) || []
|
|
82227
|
+
].filter(Boolean),
|
|
82194
82228
|
options: { ...options.componentsOptions }
|
|
82195
82229
|
},
|
|
82196
82230
|
shortcuts: [
|
|
@@ -82249,7 +82283,7 @@ ${data2.flowchartText}
|
|
|
82249
82283
|
if (!clientType.isMobile) {
|
|
82250
82284
|
editor.addCustom("editor-tooltip", () => new OnesEditorTooltip(editor));
|
|
82251
82285
|
}
|
|
82252
|
-
if (
|
|
82286
|
+
if (enableComments) {
|
|
82253
82287
|
editor.addCustom(
|
|
82254
82288
|
"editor-comments",
|
|
82255
82289
|
(editor2) => new OnesEditorComments(editor2, new ShareDBDocCommentsProvider(editor2))
|
|
@@ -82317,7 +82351,7 @@ ${data2.flowchartText}
|
|
|
82317
82351
|
}
|
|
82318
82352
|
}
|
|
82319
82353
|
});
|
|
82320
|
-
editor.version = "2.0.7-beta.
|
|
82354
|
+
editor.version = "2.0.7-beta.24";
|
|
82321
82355
|
if (Logger$2.level === LogLevel.DEBUG) {
|
|
82322
82356
|
window.setReauthFail = (fail) => {
|
|
82323
82357
|
window.isReauthError = fail;
|
|
@@ -82339,6 +82373,7 @@ ${data2.flowchartText}
|
|
|
82339
82373
|
i18n$1.setLang(options.lang);
|
|
82340
82374
|
}
|
|
82341
82375
|
Logger$2.level = (_a = options.logLevel) != null ? _a : LogLevel.DEBUG;
|
|
82376
|
+
const enableComments = options == null ? void 0 : options.enableComments;
|
|
82342
82377
|
const editor = createEditor(root2, doc2, {
|
|
82343
82378
|
id: options.id,
|
|
82344
82379
|
scrollContainer: options == null ? void 0 : options.scrollContainer,
|
|
@@ -82351,10 +82386,10 @@ ${data2.flowchartText}
|
|
|
82351
82386
|
insertions: [RemoteCaretsInsertion],
|
|
82352
82387
|
blockHooks: [new BlockLockerHook(), ...((_f = options.components) == null ? void 0 : _f.blockHooks) || []],
|
|
82353
82388
|
textRenders: [
|
|
82354
|
-
new OnesEditorCommentsRender(),
|
|
82389
|
+
enableComments && new OnesEditorCommentsRender(),
|
|
82355
82390
|
new BlockPaddingRender(),
|
|
82356
82391
|
...((_g = options.components) == null ? void 0 : _g.textRenders) || []
|
|
82357
|
-
],
|
|
82392
|
+
].filter(Boolean),
|
|
82358
82393
|
options: { ...options.componentsOptions }
|
|
82359
82394
|
},
|
|
82360
82395
|
shortcuts: [TableShortcuts, FindReplaceShortcuts, TextStyleShortcuts, DefaultShortcuts]
|
|
@@ -82384,7 +82419,7 @@ ${data2.flowchartText}
|
|
|
82384
82419
|
return new OnesEditorQuickMenu(editor, (_a2 = options.componentsOptions) == null ? void 0 : _a2.quickMenu);
|
|
82385
82420
|
});
|
|
82386
82421
|
editor.addCustom("image-paste-handler", () => new ImagePasteHandler(editor));
|
|
82387
|
-
if (
|
|
82422
|
+
if (enableComments) {
|
|
82388
82423
|
editor.addCustom(
|
|
82389
82424
|
"editor-comments",
|
|
82390
82425
|
(editor2) => new OnesEditorComments(editor2, new LocalDocCommentsProvider(editor2, doc2))
|
|
@@ -82411,7 +82446,7 @@ ${data2.flowchartText}
|
|
|
82411
82446
|
if (!clientType.isMobile) {
|
|
82412
82447
|
OnesEditorToolbar.register(editor);
|
|
82413
82448
|
}
|
|
82414
|
-
editor.version = "2.0.7-beta.
|
|
82449
|
+
editor.version = "2.0.7-beta.24";
|
|
82415
82450
|
return editor;
|
|
82416
82451
|
}
|
|
82417
82452
|
async function showDocVersions(editor, options, serverUrl) {
|