@linker-design-plus/tiny-peony 1.4.34 → 1.4.36

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.
@@ -9,6 +9,22 @@ export declare class ContentManager extends IContentManager {
9
9
  getHtml(): string;
10
10
  setContent(content: string): void;
11
11
  setHtml(content: string): void;
12
+ setMarkdown(markdown: string): void;
13
+ appendMarkdown(markdown: string): void;
14
+ /**
15
+ * 将 markdown 文本通过 marked 解析为编辑器所需的段落 HTML
16
+ * 所有块级元素内容都会被包裹在 <p class="PARAGRAPH_CLS"> 中
17
+ */
18
+ private _markdownToEditorHtml;
19
+ /**
20
+ * 将编辑器当前内容转为 Markdown 格式
21
+ * 反向解析 _markdownToEditorHtml 产出的段落结构
22
+ */
23
+ getMarkdownContent(): string;
24
+ /**
25
+ * 将段落内部的 HTML 标签转为 Markdown 内联语法
26
+ */
27
+ private _htmlToMarkdownInline;
12
28
  appendContent(content: string | string[], cb?: (para: HTMLElement) => void): void;
13
29
  insert(content: string | Node): void;
14
30
  delete(): void;
@@ -8,6 +8,7 @@ export type PluginMap<Plugins extends PluginConstructor[]> = {
8
8
  export interface EditorCoreOptions<Plugins extends PluginConstructor<IPlugin>[]> {
9
9
  plugins?: Plugins;
10
10
  maxLength: number;
11
+ wordLimitTip?: string;
11
12
  onChange?: (contentLength: number) => void;
12
13
  onUndoChange?: (anchorContent: string) => void;
13
14
  }
@@ -17,6 +18,7 @@ export declare class EditorCore<Plugins extends PluginConstructor[] = []> extend
17
18
  private _observer;
18
19
  private _onchange?;
19
20
  readonly _editorElement: HTMLElement;
21
+ readonly wordLimitTip: string;
20
22
  readonly _uid: string;
21
23
  content: IContentManager;
22
24
  cursor: ICursorManager;
package/dist/index.d.ts CHANGED
@@ -66,6 +66,10 @@ declare const TinyPeony: {
66
66
  type: BooleanConstructor;
67
67
  default: boolean;
68
68
  };
69
+ wordLimitTip: {
70
+ type: StringConstructor;
71
+ default: string;
72
+ };
69
73
  }>> & Readonly<{
70
74
  onChange?: ((contentLength: number) => any) | undefined;
71
75
  onClear?: (() => any) | undefined;
@@ -78,6 +82,9 @@ declare const TinyPeony: {
78
82
  innerRender: () => import("vue/jsx-runtime").JSX.Element;
79
83
  innerGetContent: (_options?: import("./intersection/components/editor/context").ContentOptions) => string;
80
84
  innerSetContent: (content: string) => Promise<void>;
85
+ innerSetMarkdown: (markdown: string) => Promise<void>;
86
+ innerAppendMarkdown: (markdown: string) => Promise<void>;
87
+ innerGetMarkdownContent: () => string;
81
88
  innerAppendContent: (content: string | string[]) => Promise<void>;
82
89
  innerGetTextContent: () => string[];
83
90
  innerInsertContent: (content: string | Node) => void;
@@ -97,11 +104,15 @@ declare const TinyPeony: {
97
104
  innerInsertContentAtCursor: (_content: string | string[], func?: (canInsert: boolean) => void) => void;
98
105
  innerRenderHightlight: (matchingContent: string) => void;
99
106
  innerUnrenderHightlight: () => void;
107
+ innerIsWordLengthExceeded: () => boolean;
100
108
  }, {}, {}, {
101
109
  getContent(options?: import("./intersection/components/editor/context").ContentOptions): string;
102
110
  getHtml(options: import("./intersection/components/editor/context").ContentOptions): string;
103
111
  setContent(content: string): Promise<void>;
104
112
  setHtml(content: string): Promise<void>;
113
+ setMarkdown(markdown: string): Promise<void>;
114
+ appendMarkdown(markdown: string): Promise<void>;
115
+ getMarkdownContent(): string;
105
116
  appendContent(content: string | string[]): Promise<void>;
106
117
  getTextContent(): string[];
107
118
  insertContent(content: string | Node): void;
@@ -122,6 +133,7 @@ declare const TinyPeony: {
122
133
  clear(): Promise<void>;
123
134
  renderHighlight(matchingContent: string): void;
124
135
  unrenderHighlight(): void;
136
+ isWordLengthExceeded(): boolean;
125
137
  }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
126
138
  change: (contentLength: number) => true;
127
139
  'update:textCount': (value: number) => true;
@@ -137,6 +149,7 @@ declare const TinyPeony: {
137
149
  maxLength: number;
138
150
  showWordLimit: boolean;
139
151
  simple: boolean;
152
+ wordLimitTip: string;
140
153
  preTime: string;
141
154
  textCount: number;
142
155
  listenAnchorId: string;
@@ -216,6 +229,10 @@ declare const TinyPeony: {
216
229
  type: BooleanConstructor;
217
230
  default: boolean;
218
231
  };
232
+ wordLimitTip: {
233
+ type: StringConstructor;
234
+ default: string;
235
+ };
219
236
  }>> & Readonly<{
220
237
  onChange?: ((contentLength: number) => any) | undefined;
221
238
  onClear?: (() => any) | undefined;
@@ -228,6 +245,9 @@ declare const TinyPeony: {
228
245
  innerRender: () => import("vue/jsx-runtime").JSX.Element;
229
246
  innerGetContent: (_options?: import("./intersection/components/editor/context").ContentOptions) => string;
230
247
  innerSetContent: (content: string) => Promise<void>;
248
+ innerSetMarkdown: (markdown: string) => Promise<void>;
249
+ innerAppendMarkdown: (markdown: string) => Promise<void>;
250
+ innerGetMarkdownContent: () => string;
231
251
  innerAppendContent: (content: string | string[]) => Promise<void>;
232
252
  innerGetTextContent: () => string[];
233
253
  innerInsertContent: (content: string | Node) => void;
@@ -247,11 +267,15 @@ declare const TinyPeony: {
247
267
  innerInsertContentAtCursor: (_content: string | string[], func?: (canInsert: boolean) => void) => void;
248
268
  innerRenderHightlight: (matchingContent: string) => void;
249
269
  innerUnrenderHightlight: () => void;
270
+ innerIsWordLengthExceeded: () => boolean;
250
271
  }, {}, {}, {
251
272
  getContent(options?: import("./intersection/components/editor/context").ContentOptions): string;
252
273
  getHtml(options: import("./intersection/components/editor/context").ContentOptions): string;
253
274
  setContent(content: string): Promise<void>;
254
275
  setHtml(content: string): Promise<void>;
276
+ setMarkdown(markdown: string): Promise<void>;
277
+ appendMarkdown(markdown: string): Promise<void>;
278
+ getMarkdownContent(): string;
255
279
  appendContent(content: string | string[]): Promise<void>;
256
280
  getTextContent(): string[];
257
281
  insertContent(content: string | Node): void;
@@ -272,6 +296,7 @@ declare const TinyPeony: {
272
296
  clear(): Promise<void>;
273
297
  renderHighlight(matchingContent: string): void;
274
298
  unrenderHighlight(): void;
299
+ isWordLengthExceeded(): boolean;
275
300
  }, {
276
301
  highlight: boolean;
277
302
  class: string | unknown[];
@@ -280,6 +305,7 @@ declare const TinyPeony: {
280
305
  maxLength: number;
281
306
  showWordLimit: boolean;
282
307
  simple: boolean;
308
+ wordLimitTip: string;
283
309
  preTime: string;
284
310
  textCount: number;
285
311
  listenAnchorId: string;
@@ -356,6 +382,10 @@ declare const TinyPeony: {
356
382
  type: BooleanConstructor;
357
383
  default: boolean;
358
384
  };
385
+ wordLimitTip: {
386
+ type: StringConstructor;
387
+ default: string;
388
+ };
359
389
  }>> & Readonly<{
360
390
  onChange?: ((contentLength: number) => any) | undefined;
361
391
  onClear?: (() => any) | undefined;
@@ -368,6 +398,9 @@ declare const TinyPeony: {
368
398
  innerRender: () => import("vue/jsx-runtime").JSX.Element;
369
399
  innerGetContent: (_options?: import("./intersection/components/editor/context").ContentOptions) => string;
370
400
  innerSetContent: (content: string) => Promise<void>;
401
+ innerSetMarkdown: (markdown: string) => Promise<void>;
402
+ innerAppendMarkdown: (markdown: string) => Promise<void>;
403
+ innerGetMarkdownContent: () => string;
371
404
  innerAppendContent: (content: string | string[]) => Promise<void>;
372
405
  innerGetTextContent: () => string[];
373
406
  innerInsertContent: (content: string | Node) => void;
@@ -387,11 +420,15 @@ declare const TinyPeony: {
387
420
  innerInsertContentAtCursor: (_content: string | string[], func?: (canInsert: boolean) => void) => void;
388
421
  innerRenderHightlight: (matchingContent: string) => void;
389
422
  innerUnrenderHightlight: () => void;
423
+ innerIsWordLengthExceeded: () => boolean;
390
424
  }, {}, {}, {
391
425
  getContent(options?: import("./intersection/components/editor/context").ContentOptions): string;
392
426
  getHtml(options: import("./intersection/components/editor/context").ContentOptions): string;
393
427
  setContent(content: string): Promise<void>;
394
428
  setHtml(content: string): Promise<void>;
429
+ setMarkdown(markdown: string): Promise<void>;
430
+ appendMarkdown(markdown: string): Promise<void>;
431
+ getMarkdownContent(): string;
395
432
  appendContent(content: string | string[]): Promise<void>;
396
433
  getTextContent(): string[];
397
434
  insertContent(content: string | Node): void;
@@ -412,6 +449,7 @@ declare const TinyPeony: {
412
449
  clear(): Promise<void>;
413
450
  renderHighlight(matchingContent: string): void;
414
451
  unrenderHighlight(): void;
452
+ isWordLengthExceeded(): boolean;
415
453
  }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
416
454
  change: (contentLength: number) => true;
417
455
  'update:textCount': (value: number) => true;
@@ -427,6 +465,7 @@ declare const TinyPeony: {
427
465
  maxLength: number;
428
466
  showWordLimit: boolean;
429
467
  simple: boolean;
468
+ wordLimitTip: string;
430
469
  preTime: string;
431
470
  textCount: number;
432
471
  listenAnchorId: string;