vdc-editor 0.1.105 → 0.1.106
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/lib/src/extensions/BaseKit.d.ts +6 -3
- package/lib/src/extensions/TimeHighlighter/TimeHighlighter.d.ts +4 -1
- package/lib/src/extensions/TimeHighlighter/timeWords.d.ts +1 -1
- package/lib/vdc-editor.mjs +20 -7
- package/lib/vdc-editor.mjs.map +1 -1
- package/lib/vdc-editor.umd.js +1 -1
- package/lib/vdc-editor.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ import { PageOption } from '../type';
|
|
|
12
12
|
import { FontFamilyOptions } from './FontFamily';
|
|
13
13
|
import { FontSizeOptions } from './FontSize';
|
|
14
14
|
import { HistoryOptions } from '@tiptap/extension-history';
|
|
15
|
+
import { TimeHighlighterOptions } from './TimeHighlighter';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Represents the interface for options in the base toolkit.
|
|
@@ -156,10 +157,12 @@ export interface BaseKitOptions {
|
|
|
156
157
|
*/
|
|
157
158
|
fontFamily: Partial<FontFamilyOptions> | false;
|
|
158
159
|
/**
|
|
159
|
-
* timeHighlighter
|
|
160
|
+
* timeHighlighter options or false, indicating whether to enable timeHighlighter
|
|
161
|
+
* additionalTimeWords is an array of additional time words regex
|
|
162
|
+
* If adding additionalTimeWords cause memory issue, please check the added regex pattern
|
|
160
163
|
*
|
|
161
|
-
* @default
|
|
164
|
+
* @default false
|
|
162
165
|
*/
|
|
163
|
-
timeHighlighter:
|
|
166
|
+
timeHighlighter: Partial<TimeHighlighterOptions> | false;
|
|
164
167
|
}
|
|
165
168
|
export declare const BaseKit: Extension<BaseKitOptions, any>;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Extension } from '@tiptap/core';
|
|
2
2
|
|
|
3
3
|
export declare const TIME_HIGH_LIGHTER_EXTENSION_NAME = "time-highlighter";
|
|
4
|
-
export
|
|
4
|
+
export interface TimeHighlighterOptions {
|
|
5
|
+
additionalTimeWords: string[];
|
|
6
|
+
}
|
|
7
|
+
export declare const TimeHighlighter: Extension<TimeHighlighterOptions, any>;
|
package/lib/vdc-editor.mjs
CHANGED
|
@@ -46989,21 +46989,32 @@ const Nf = ({ editor: t }) => {
|
|
|
46989
46989
|
examples: ["2015년", "2024년", "1998년"],
|
|
46990
46990
|
pattern: "\\d{4}년"
|
|
46991
46991
|
}
|
|
46992
|
-
], Bne = () => {
|
|
46993
|
-
const
|
|
46994
|
-
return new RegExp(
|
|
46992
|
+
], Bne = (t) => {
|
|
46993
|
+
const e = [...t || [], ...Pne.map((n) => n.pattern)].join("|");
|
|
46994
|
+
return new RegExp(e, "gu");
|
|
46995
46995
|
}, Fne = "time-highlighter", $ne = Et.create({
|
|
46996
46996
|
name: Fne,
|
|
46997
|
+
addOptions() {
|
|
46998
|
+
return {
|
|
46999
|
+
additionalTimeWords: []
|
|
47000
|
+
};
|
|
47001
|
+
},
|
|
47002
|
+
addStorage() {
|
|
47003
|
+
return {
|
|
47004
|
+
cachedRegex: null,
|
|
47005
|
+
cachedAdditionalWords: null
|
|
47006
|
+
};
|
|
47007
|
+
},
|
|
46997
47008
|
addProseMirrorPlugins() {
|
|
46998
47009
|
return [
|
|
46999
47010
|
new At({
|
|
47000
47011
|
props: {
|
|
47001
47012
|
decorations: (t) => {
|
|
47002
47013
|
const e = [];
|
|
47003
|
-
return t.doc.descendants((n, r) => {
|
|
47014
|
+
return (this.storage.cachedAdditionalWords !== this.options.additionalTimeWords || !this.storage.cachedRegex) && (this.storage.cachedAdditionalWords = this.options.additionalTimeWords, this.storage.cachedRegex = Bne(this.options.additionalTimeWords)), t.doc.descendants((n, r) => {
|
|
47004
47015
|
if (!n.isText) return;
|
|
47005
47016
|
let o;
|
|
47006
|
-
const i =
|
|
47017
|
+
const i = this.storage.cachedRegex;
|
|
47007
47018
|
for (; o = i.exec(n.text || ""); ) {
|
|
47008
47019
|
const s = r + o.index, a = s + o[0].length;
|
|
47009
47020
|
e.push(gn.inline(s, a, { class: "time-highlight" }));
|
|
@@ -47020,7 +47031,9 @@ const Nf = ({ editor: t }) => {
|
|
|
47020
47031
|
var t;
|
|
47021
47032
|
return {
|
|
47022
47033
|
...(t = this.parent) == null ? void 0 : t.call(this),
|
|
47023
|
-
timeHighlighter:
|
|
47034
|
+
timeHighlighter: {
|
|
47035
|
+
additionalTimeWords: []
|
|
47036
|
+
},
|
|
47024
47037
|
bubble: {
|
|
47025
47038
|
list: rF,
|
|
47026
47039
|
defaultBubbleList: KZ,
|
|
@@ -47072,7 +47085,7 @@ const Nf = ({ editor: t }) => {
|
|
|
47072
47085
|
jx.configure({
|
|
47073
47086
|
specialCharModal: (i = this.options.configPlan) == null ? void 0 : i.specialCharModal
|
|
47074
47087
|
})
|
|
47075
|
-
)), this.options.mode !== dt.EDITOR && this.options.mode !== dt.PLAIN_TEXT && e.push(Wee), (this.options.mode === dt.STRAIGHT || this.options.mode === dt.REPORT || this.options.mode === dt.EDITOR) && this.options.timeHighlighter && e.push($ne), e.push(
|
|
47088
|
+
)), this.options.mode !== dt.EDITOR && this.options.mode !== dt.PLAIN_TEXT && e.push(Wee), (this.options.mode === dt.STRAIGHT || this.options.mode === dt.REPORT || this.options.mode === dt.EDITOR) && this.options.timeHighlighter && e.push($ne.configure(this.options.timeHighlighter)), e.push(
|
|
47076
47089
|
jZ,
|
|
47077
47090
|
zS.configure(),
|
|
47078
47091
|
Dne.configure(),
|