@ones-editor/editor 3.0.3 → 3.0.4-beta.1
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/types.d.ts +1 -0
- package/@ones-editor/input-handlers/src/markdown-shortcuts/markdown-input-handler.d.ts +3 -0
- package/@ones-editor/input-handlers/src/markdown-shortcuts/match-block-style.d.ts +2 -1
- package/@ones-editor/input-handlers/src/markdown-shortcuts/types.d.ts +3 -0
- package/@ones-editor/main-toolbar/src/items/text-color.d.ts +1 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +93 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export * from '../@ones-editor/layout-block';
|
|
|
30
30
|
export * from '../@ones-editor/markdown-to-doc';
|
|
31
31
|
export * from '../@ones-editor/html-to-doc';
|
|
32
32
|
export * from '../@ones-editor/main-toolbar';
|
|
33
|
+
export * from '../@ones-editor/mention';
|
|
33
34
|
export { Popup, ManualMenu, OnesEditorAutoSuggest, tippy, ManualToolbar, ManualCloseDialog, TextColorItem, shouldFocusToEditor, FixedToolbar, } from '../@ones-editor/ui-base';
|
|
34
35
|
export * from '../@ones-editor/drawio-embed';
|
|
35
36
|
export * from '../@ones-editor/block-resizer';
|
|
@@ -108,3 +109,4 @@ export interface ShowDocVersionsOptions2 {
|
|
|
108
109
|
editorOptions?: CreateOnesEditorOptions;
|
|
109
110
|
}
|
|
110
111
|
export declare function showDocVersions2(parent: HTMLElement, options: ShowDocVersionsOptions2): Promise<OnesEditorVersionsDialog>;
|
|
112
|
+
export declare function createSimpleInput(root: HTMLElement, docData: DocObject | OnesEditorDoc, options: CreateLocalEditorOptions): Promise<OnesEditor>;
|
package/dist/index.js
CHANGED
|
@@ -42628,6 +42628,9 @@ ${codeText}
|
|
|
42628
42628
|
function initMenuItem$1(item, elem) {
|
|
42629
42629
|
var _a, _b;
|
|
42630
42630
|
addClass(elem, "menu-item");
|
|
42631
|
+
if (item.className) {
|
|
42632
|
+
addClass(elem, ...item.className.split(" "));
|
|
42633
|
+
}
|
|
42631
42634
|
if (item.element) {
|
|
42632
42635
|
return;
|
|
42633
42636
|
}
|
|
@@ -42703,6 +42706,9 @@ ${codeText}
|
|
|
42703
42706
|
});
|
|
42704
42707
|
}
|
|
42705
42708
|
function initToolbarItem(item, elem, options) {
|
|
42709
|
+
if (item.className) {
|
|
42710
|
+
addClass(elem, ...item.className.split(" "));
|
|
42711
|
+
}
|
|
42706
42712
|
elem.setAttribute("data-button-id", item.id);
|
|
42707
42713
|
if (options.tooltipId && item.name && !item.disableTooltip) {
|
|
42708
42714
|
elem.setAttribute(`data-editor-tooltip-${options.tooltipId}`, item.name);
|
|
@@ -66958,9 +66964,11 @@ ${codeText}
|
|
|
66958
66964
|
});
|
|
66959
66965
|
return true;
|
|
66960
66966
|
}
|
|
66961
|
-
function matchBlockStyle(editor, containerId, blockIndex, offset) {
|
|
66962
|
-
if (
|
|
66963
|
-
|
|
66967
|
+
function matchBlockStyle(editor, containerId, blockIndex, offset, options) {
|
|
66968
|
+
if ((options == null ? void 0 : options.disableHeadingShortcuts) !== true) {
|
|
66969
|
+
if (matchHeading(editor, containerId, blockIndex, offset)) {
|
|
66970
|
+
return true;
|
|
66971
|
+
}
|
|
66964
66972
|
}
|
|
66965
66973
|
if (matchBlockQuote(editor, containerId, blockIndex, offset)) {
|
|
66966
66974
|
return true;
|
|
@@ -67065,12 +67073,15 @@ ${codeText}
|
|
|
67065
67073
|
return false;
|
|
67066
67074
|
}
|
|
67067
67075
|
class MarkdownInputHandler {
|
|
67076
|
+
constructor(options) {
|
|
67077
|
+
this.options = options;
|
|
67078
|
+
}
|
|
67068
67079
|
handleAfterInsertText(editor, containerId, blockIndex, offset, text2) {
|
|
67069
67080
|
if (text2 === " ") {
|
|
67070
67081
|
if (converterIntercept(editor, containerId)) {
|
|
67071
67082
|
return false;
|
|
67072
67083
|
}
|
|
67073
|
-
if (matchBlockStyle(editor, containerId, blockIndex, offset)) {
|
|
67084
|
+
if (matchBlockStyle(editor, containerId, blockIndex, offset, this.options)) {
|
|
67074
67085
|
return true;
|
|
67075
67086
|
}
|
|
67076
67087
|
if (matchTextStyle(editor, containerId, blockIndex, offset)) {
|
|
@@ -95506,9 +95517,8 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
95506
95517
|
}
|
|
95507
95518
|
const elem = node;
|
|
95508
95519
|
const refId = elem.getAttribute("data-ref-id");
|
|
95509
|
-
const refType = elem.getAttribute("data-ref-type");
|
|
95510
95520
|
const uuid = elem.getAttribute("data-uuid");
|
|
95511
|
-
return Boolean(
|
|
95521
|
+
return Boolean(refId && uuid);
|
|
95512
95522
|
},
|
|
95513
95523
|
replacement: (content, node) => {
|
|
95514
95524
|
const refType = node.getAttribute("data-ref-type");
|
|
@@ -96046,7 +96056,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96046
96056
|
}
|
|
96047
96057
|
}
|
|
96048
96058
|
});
|
|
96049
|
-
editor.version = "3.0.
|
|
96059
|
+
editor.version = "3.0.4-beta.1";
|
|
96050
96060
|
return editor;
|
|
96051
96061
|
}
|
|
96052
96062
|
function isDoc(doc2) {
|
|
@@ -96180,7 +96190,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96180
96190
|
OnesEditorDropTarget.register(editor);
|
|
96181
96191
|
OnesEditorTocProvider.register(editor);
|
|
96182
96192
|
OnesEditorExclusiveBlock.register(editor);
|
|
96183
|
-
editor.version = "3.0.
|
|
96193
|
+
editor.version = "3.0.4-beta.1";
|
|
96184
96194
|
return editor;
|
|
96185
96195
|
}
|
|
96186
96196
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -96247,6 +96257,77 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96247
96257
|
dialog.show(dialogOptions);
|
|
96248
96258
|
return dialog;
|
|
96249
96259
|
}
|
|
96260
|
+
async function createSimpleInput(root2, docData, options) {
|
|
96261
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
96262
|
+
assert(logger, root2, "app does not exists");
|
|
96263
|
+
const doc2 = isDoc(docData) ? docData : new LocalDoc(docData, {
|
|
96264
|
+
serverUrl: options.serverUrl || ""
|
|
96265
|
+
});
|
|
96266
|
+
if (options.lang) {
|
|
96267
|
+
i18n$1.setLang(options.lang);
|
|
96268
|
+
}
|
|
96269
|
+
Logger$2.level = (_a = options.logLevel) != null ? _a : LogLevel.DEBUG;
|
|
96270
|
+
const editor = createEditor(root2, doc2, {
|
|
96271
|
+
id: options.id,
|
|
96272
|
+
scrollContainer: options == null ? void 0 : options.scrollContainer,
|
|
96273
|
+
enableResolveComments: false,
|
|
96274
|
+
enableComments: false,
|
|
96275
|
+
dateTimeFormatter: options.dateTimeFormatter,
|
|
96276
|
+
components: {
|
|
96277
|
+
blocks: [ListBlock, ...(_c = (_b = options.components) == null ? void 0 : _b.blocks) != null ? _c : []],
|
|
96278
|
+
commandProviders: [],
|
|
96279
|
+
decorators: [],
|
|
96280
|
+
embeds: [...((_d = options.components) == null ? void 0 : _d.embeds) || []],
|
|
96281
|
+
boxes: [...((_e = options.components) == null ? void 0 : _e.boxes) || []],
|
|
96282
|
+
insertions: [],
|
|
96283
|
+
blockHooks: [...((_f = options.components) == null ? void 0 : _f.blockHooks) || []],
|
|
96284
|
+
textRenders: [
|
|
96285
|
+
...((_g = options.components) == null ? void 0 : _g.textRenders) || []
|
|
96286
|
+
].filter(Boolean),
|
|
96287
|
+
options: { ...options.componentsOptions }
|
|
96288
|
+
},
|
|
96289
|
+
shortcuts: [TextStyleShortcuts, DefaultShortcuts]
|
|
96290
|
+
});
|
|
96291
|
+
if (options.compact) {
|
|
96292
|
+
addClass(editor.rootElement, "compact");
|
|
96293
|
+
if (options.headingButton === false)
|
|
96294
|
+
addClass(editor.rootElement, "no-heading-collapse");
|
|
96295
|
+
if (options.blockMenuButton === false)
|
|
96296
|
+
addClass(editor.rootElement, "no-block-menu");
|
|
96297
|
+
}
|
|
96298
|
+
editor.input.addHandler(new MarkdownInputHandler({
|
|
96299
|
+
disableHeadingShortcuts: true
|
|
96300
|
+
}));
|
|
96301
|
+
editor.input.addHandler(new OnesEditorPasteHandler(editor));
|
|
96302
|
+
editor.input.addHandler(new ListPasteHandler());
|
|
96303
|
+
editor.doc.registerCallback(new HeadingBlockDocEvents(editor));
|
|
96304
|
+
if (!clientType.isMobile) {
|
|
96305
|
+
editor.addCustom("editor-tooltip", () => new OnesEditorTooltip(editor));
|
|
96306
|
+
}
|
|
96307
|
+
editor.addCustom("create-options", () => new OnesEditorCustomDataWrapper(editor, options));
|
|
96308
|
+
if ((_h = options.componentsOptions) == null ? void 0 : _h.mention) {
|
|
96309
|
+
const mentionOptions = options.componentsOptions.mention;
|
|
96310
|
+
editor.addCustom("mention", () => new OnesEditorMention(editor, mentionOptions));
|
|
96311
|
+
}
|
|
96312
|
+
if (options.autoNewLine) {
|
|
96313
|
+
editor.addCustom("auto-new-line", () => new AutoNewLine(editor));
|
|
96314
|
+
}
|
|
96315
|
+
editor.addListener("clickLink", (editor2, event, link2) => {
|
|
96316
|
+
var _a2;
|
|
96317
|
+
if ((_a2 = options == null ? void 0 : options.events) == null ? void 0 : _a2.onClickLink) {
|
|
96318
|
+
options.events.onClickLink(editor2, event, link2);
|
|
96319
|
+
return;
|
|
96320
|
+
}
|
|
96321
|
+
const href = link2.getAttribute("link") || link2.getAttribute("href");
|
|
96322
|
+
if (href) {
|
|
96323
|
+
if (editor2.readonly || event.ctrlKey || event.metaKey || !getParentBlock(link2)) {
|
|
96324
|
+
window.open(href, "_blank");
|
|
96325
|
+
}
|
|
96326
|
+
}
|
|
96327
|
+
});
|
|
96328
|
+
editor.version = "3.0.4-beta.1";
|
|
96329
|
+
return editor;
|
|
96330
|
+
}
|
|
96250
96331
|
const emojis$1 = {
|
|
96251
96332
|
smileysAndPeople: [
|
|
96252
96333
|
"\u{1F600}",
|
|
@@ -142150,6 +142231,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
142150
142231
|
exports2.MathMenuIcon = MathMenuIcon;
|
|
142151
142232
|
exports2.MaxUserError = MaxUserError;
|
|
142152
142233
|
exports2.Mention2Icon = Mention2Icon;
|
|
142234
|
+
exports2.MentionBox = MentionBox;
|
|
142153
142235
|
exports2.MentionIcon = MentionIcon;
|
|
142154
142236
|
exports2.MergeCellIcon = MergeCellIcon;
|
|
142155
142237
|
exports2.Mindmap = Mindmap;
|
|
@@ -142162,12 +142244,14 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
142162
142244
|
exports2.MoreItem = MoreItem;
|
|
142163
142245
|
exports2.NextIcon = NextIcon;
|
|
142164
142246
|
exports2.OnesEditorAutoSuggest = OnesEditorAutoSuggest;
|
|
142247
|
+
exports2.OnesEditorBlockMention = OnesEditorBlockMention;
|
|
142165
142248
|
exports2.OnesEditorComments = OnesEditorComments;
|
|
142166
142249
|
exports2.OnesEditorCommentsRender = OnesEditorCommentsRender;
|
|
142167
142250
|
exports2.OnesEditorCustomDataWrapper = OnesEditorCustomDataWrapper;
|
|
142168
142251
|
exports2.OnesEditorExclusiveBlock = OnesEditorExclusiveBlock;
|
|
142169
142252
|
exports2.OnesEditorHoveringBlock = OnesEditorHoveringBlock;
|
|
142170
142253
|
exports2.OnesEditorIcons = index$f;
|
|
142254
|
+
exports2.OnesEditorMention = OnesEditorMention;
|
|
142171
142255
|
exports2.OnesEditorQuickMenu = OnesEditorQuickMenu;
|
|
142172
142256
|
exports2.OnesEditorToc = OnesEditorToc;
|
|
142173
142257
|
exports2.OnesEditorTocProvider = OnesEditorTocProvider;
|
|
@@ -142365,6 +142449,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
142365
142449
|
exports2.createSeparator = createSeparator;
|
|
142366
142450
|
exports2.createSimpleBlockPosition = createSimpleBlockPosition;
|
|
142367
142451
|
exports2.createSimpleDocPos = createSimpleDocPos;
|
|
142452
|
+
exports2.createSimpleInput = createSimpleInput;
|
|
142368
142453
|
exports2.createTextBlockData = createTextBlockData;
|
|
142369
142454
|
exports2.createTextButton = createTextButton;
|
|
142370
142455
|
exports2.createTextOp = createTextOp;
|