@norio-office/rich-text 0.1.0 → 0.3.0
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/README.md +1147 -971
- package/dist/{chunk-efA98nb6.js → chunk-C_CI6nMA.js} +1 -1
- package/dist/components/OutlinePanel.vue.d.ts +22 -11
- package/dist/components/RichTextEditor.vue.d.ts +25 -1
- package/dist/components/RichTextOutline.vue.d.ts +30 -0
- package/dist/composables/useRichTextEditor.d.ts +7 -2
- package/dist/extensions/image-block.d.ts +7 -1
- package/dist/extensions/video-block.d.ts +7 -1
- package/dist/{html2canvas-Bwmq6fGh.js → html2canvas-CmV4ppBE.js} +2 -2
- package/dist/index.d.ts +3 -2
- package/dist/{index.es-C4X5YiRo.js → index.es-D5dDjrL4.js} +1 -1
- package/dist/index.js +5513 -4766
- package/dist/index.umd.cjs +871 -589
- package/dist/{jspdf.es.min-ByaXFVjc.js → jspdf.es.min-B2a2-__Q.js} +17 -17
- package/dist/purify.es-jA1o6Tcu.js +597 -0
- package/dist/style.css +1 -1
- package/dist/types.d.ts +58 -24
- package/dist/utils/url.d.ts +2 -0
- package/docs/usage.md +66 -95
- package/package.json +2 -8
- package/dist/purify.es-B5ixYH9L.js +0 -549
- package/yjs/README.md +0 -63
- package/yjs/index.js +0 -224
- package/yjs/package.json +0 -14
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region \0rolldown/runtime.js
|
|
2
|
-
var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), s = (e, i, o, s) => {
|
|
2
|
+
var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, i, o, s) => {
|
|
3
3
|
if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
|
|
4
4
|
get: ((e) => i[e]).bind(null, d),
|
|
5
5
|
enumerable: !(s = n(i, d)) || s.enumerable
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { RichTextEditorOutlineItem } from '../types';
|
|
1
2
|
type __VLS_Props = {
|
|
2
|
-
open
|
|
3
|
-
placement
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
open?: boolean;
|
|
4
|
+
placement?: 'left' | 'right';
|
|
5
|
+
title?: string;
|
|
6
|
+
collapseTitle?: string;
|
|
7
|
+
emptyDescription?: string;
|
|
8
|
+
emptyTip?: string;
|
|
9
|
+
showCollapse?: boolean;
|
|
10
|
+
internal?: boolean;
|
|
11
|
+
standalone?: boolean;
|
|
12
|
+
items: RichTextEditorOutlineItem[];
|
|
12
13
|
activePos: number | null;
|
|
13
14
|
};
|
|
14
15
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
@@ -17,5 +18,15 @@ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
17
18
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
18
19
|
onSelect?: ((pos: number) => any) | undefined;
|
|
19
20
|
onToggle?: (() => any) | undefined;
|
|
20
|
-
}>, {
|
|
21
|
+
}>, {
|
|
22
|
+
title: string;
|
|
23
|
+
open: boolean;
|
|
24
|
+
placement: "left" | "right";
|
|
25
|
+
collapseTitle: string;
|
|
26
|
+
emptyDescription: string;
|
|
27
|
+
emptyTip: string;
|
|
28
|
+
showCollapse: boolean;
|
|
29
|
+
internal: boolean;
|
|
30
|
+
standalone: boolean;
|
|
31
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLElement>;
|
|
21
32
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSONContent } from '@tiptap/core';
|
|
2
|
-
import { RichTextEditorFilePayload, RichTextEditorImageExportOptions, RichTextEditorImagePayload, RichTextEditorLocalFilePayload, RichTextEditorMentionItem, RichTextEditorProps, RichTextEditorVideoPayload } from '../types';
|
|
2
|
+
import { RichTextEditorFilePayload, RichTextEditorCollectedFilePayload, RichTextEditorImageExportOptions, RichTextEditorImagePayload, RichTextEditorLocalFilePayload, RichTextEditorMentionItem, RichTextEditorOutlineChangeHandler, RichTextEditorOutlineItem, RichTextEditorOutlineState, RichTextEditorProps, RichTextEditorUploadErrorPayload, RichTextEditorWatermarkOptions, RichTextEditorVideoPayload } from '../types';
|
|
3
3
|
declare const _default: import('vue').DefineComponent<RichTextEditorProps, {
|
|
4
4
|
exportPdf: () => Promise<Blob | null>;
|
|
5
5
|
exportImage: (options?: RichTextEditorImageExportOptions) => Promise<Blob | null>;
|
|
@@ -12,27 +12,49 @@ declare const _default: import('vue').DefineComponent<RichTextEditorProps, {
|
|
|
12
12
|
openLocalFilePicker: () => void;
|
|
13
13
|
focus: () => void;
|
|
14
14
|
getJSON: () => JSONContent | null;
|
|
15
|
+
getText: () => string;
|
|
16
|
+
getImages: () => RichTextEditorImagePayload[];
|
|
17
|
+
getVideos: () => RichTextEditorVideoPayload[];
|
|
18
|
+
getFiles: () => RichTextEditorCollectedFilePayload[];
|
|
19
|
+
getOutlineItems: () => RichTextEditorOutlineItem[];
|
|
20
|
+
getActiveOutlinePos: () => number | null;
|
|
21
|
+
focusOutlineItem: (pos: number) => boolean;
|
|
22
|
+
onOutlineChange: (handler: RichTextEditorOutlineChangeHandler) => () => void;
|
|
15
23
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
16
24
|
change: (value: JSONContent) => any;
|
|
17
25
|
"update:modelValue": (value: JSONContent) => any;
|
|
18
26
|
"local-file-upload": (value: RichTextEditorLocalFilePayload) => any;
|
|
27
|
+
"local-file-click": (value: RichTextEditorLocalFilePayload) => any;
|
|
19
28
|
"local-file-download": (value: RichTextEditorLocalFilePayload) => any;
|
|
29
|
+
"upload-error": (value: RichTextEditorUploadErrorPayload) => any;
|
|
20
30
|
"mention-item-click": (value: RichTextEditorMentionItem) => any;
|
|
21
31
|
"mention-submit": (value: RichTextEditorMentionItem) => any;
|
|
32
|
+
"outline-change": (value: RichTextEditorOutlineState) => any;
|
|
22
33
|
}, string, import('vue').PublicProps, Readonly<RichTextEditorProps> & Readonly<{
|
|
23
34
|
onChange?: ((value: JSONContent) => any) | undefined;
|
|
24
35
|
"onUpdate:modelValue"?: ((value: JSONContent) => any) | undefined;
|
|
25
36
|
"onLocal-file-upload"?: ((value: RichTextEditorLocalFilePayload) => any) | undefined;
|
|
37
|
+
"onLocal-file-click"?: ((value: RichTextEditorLocalFilePayload) => any) | undefined;
|
|
26
38
|
"onLocal-file-download"?: ((value: RichTextEditorLocalFilePayload) => any) | undefined;
|
|
39
|
+
"onUpload-error"?: ((value: RichTextEditorUploadErrorPayload) => any) | undefined;
|
|
27
40
|
"onMention-item-click"?: ((value: RichTextEditorMentionItem) => any) | undefined;
|
|
28
41
|
"onMention-submit"?: ((value: RichTextEditorMentionItem) => any) | undefined;
|
|
42
|
+
"onOutline-change"?: ((value: RichTextEditorOutlineState) => any) | undefined;
|
|
29
43
|
}>, {
|
|
30
44
|
placeholder: string;
|
|
31
45
|
mode: "edit" | "preview";
|
|
46
|
+
mention: boolean;
|
|
32
47
|
editable: boolean;
|
|
48
|
+
uploadImage: import('..').RichTextEditorUploadHook | null;
|
|
49
|
+
onUploadError: import('..').RichTextEditorUploadErrorHandler | null;
|
|
50
|
+
uploadVideo: import('..').RichTextEditorUploadHook | null;
|
|
33
51
|
modelValue: JSONContent | null;
|
|
52
|
+
documentName: string;
|
|
53
|
+
watermark: RichTextEditorWatermarkOptions | null;
|
|
54
|
+
showOutline: boolean;
|
|
34
55
|
outlinePlacement: "left" | "right";
|
|
35
56
|
messages: import('..').RichTextEditorMessages | null;
|
|
57
|
+
uploadFile: import('..').RichTextEditorUploadHook | null;
|
|
36
58
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
37
59
|
rootRef: HTMLDivElement;
|
|
38
60
|
insertMenuRef: HTMLDivElement;
|
|
@@ -65,5 +87,7 @@ declare const _default: import('vue').DefineComponent<RichTextEditorProps, {
|
|
|
65
87
|
blockSideColorPickerRef: HTMLInputElement;
|
|
66
88
|
markdownImportInputRef: HTMLInputElement;
|
|
67
89
|
localFileInputRef: HTMLInputElement;
|
|
90
|
+
imageUploadInputRef: HTMLInputElement;
|
|
91
|
+
videoUploadInputRef: HTMLInputElement;
|
|
68
92
|
}, HTMLDivElement>;
|
|
69
93
|
export default _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { RichTextEditorInstance, RichTextEditorOutlineState } from '../types';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
editor: RichTextEditorInstance | Ref<RichTextEditorInstance | null> | null;
|
|
5
|
+
open?: boolean;
|
|
6
|
+
placement?: 'left' | 'right';
|
|
7
|
+
title?: string;
|
|
8
|
+
collapseTitle?: string;
|
|
9
|
+
emptyDescription?: string;
|
|
10
|
+
emptyTip?: string;
|
|
11
|
+
showCollapse?: boolean;
|
|
12
|
+
};
|
|
13
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
14
|
+
select: (pos: number) => any;
|
|
15
|
+
toggle: () => any;
|
|
16
|
+
change: (state: RichTextEditorOutlineState) => any;
|
|
17
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
18
|
+
onSelect?: ((pos: number) => any) | undefined;
|
|
19
|
+
onToggle?: (() => any) | undefined;
|
|
20
|
+
onChange?: ((state: RichTextEditorOutlineState) => any) | undefined;
|
|
21
|
+
}>, {
|
|
22
|
+
title: string;
|
|
23
|
+
open: boolean;
|
|
24
|
+
placement: "left" | "right";
|
|
25
|
+
collapseTitle: string;
|
|
26
|
+
emptyDescription: string;
|
|
27
|
+
emptyTip: string;
|
|
28
|
+
showCollapse: boolean;
|
|
29
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLElement>;
|
|
30
|
+
export default _default;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { JSONContent } from '@tiptap/core';
|
|
2
|
-
import {
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
|
+
import { RichTextEditorLocalFilePayload, RichTextEditorMentionItem, RichTextEditorUploadErrorHandler, RichTextEditorUploadHook } from '../types';
|
|
3
4
|
type UseRichTextEditorOptions = {
|
|
4
5
|
content: JSONContent;
|
|
5
6
|
editable: boolean;
|
|
6
7
|
placeholder: string;
|
|
7
|
-
|
|
8
|
+
uploadImage?: RichTextEditorUploadHook | Ref<RichTextEditorUploadHook | null | undefined> | null;
|
|
9
|
+
uploadVideo?: RichTextEditorUploadHook | Ref<RichTextEditorUploadHook | null | undefined> | null;
|
|
10
|
+
onUploadError?: RichTextEditorUploadErrorHandler | Ref<RichTextEditorUploadErrorHandler | null | undefined> | null;
|
|
11
|
+
mention?: boolean | Ref<boolean | undefined> | null;
|
|
12
|
+
onLocalFileClick?: (payload: RichTextEditorLocalFilePayload) => void;
|
|
8
13
|
onLocalFileDownload?: (payload: {
|
|
9
14
|
url: string;
|
|
10
15
|
name: string;
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import { Node } from '@tiptap/core';
|
|
2
|
-
|
|
2
|
+
import { RichTextEditorUploadErrorHandler, RichTextEditorUploadHook } from '../types';
|
|
3
|
+
type ImageBlockOptions = {
|
|
4
|
+
uploadImage: RichTextEditorUploadHook | null;
|
|
5
|
+
onUploadError: RichTextEditorUploadErrorHandler | null;
|
|
6
|
+
};
|
|
7
|
+
export declare const ImageBlock: Node<ImageBlockOptions, any>;
|
|
8
|
+
export {};
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import { Node } from '@tiptap/core';
|
|
2
|
-
|
|
2
|
+
import { RichTextEditorUploadErrorHandler, RichTextEditorUploadHook } from '../types';
|
|
3
|
+
type VideoBlockOptions = {
|
|
4
|
+
uploadVideo: RichTextEditorUploadHook | null;
|
|
5
|
+
onUploadError: RichTextEditorUploadErrorHandler | null;
|
|
6
|
+
};
|
|
7
|
+
export declare const VideoBlock: Node<VideoBlockOptions, any>;
|
|
8
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./chunk-
|
|
1
|
+
import { t as e } from "./chunk-C_CI6nMA.js";
|
|
2
2
|
//#region ../../node_modules/html2canvas/dist/html2canvas.js
|
|
3
3
|
var t = /* @__PURE__ */ e(((e, t) => {
|
|
4
4
|
(function(n, r) {
|
|
@@ -2141,7 +2141,7 @@ var t = /* @__PURE__ */ e(((e, t) => {
|
|
|
2141
2141
|
function e(e, t) {
|
|
2142
2142
|
this.animationDuration = G(e, Sa, t.animationDuration), this.backgroundClip = G(e, Er, t.backgroundClip), this.backgroundColor = G(e, Dr, t.backgroundColor), this.backgroundImage = G(e, Qr, t.backgroundImage), this.backgroundOrigin = G(e, $r, t.backgroundOrigin), this.backgroundPosition = G(e, ei, t.backgroundPosition), this.backgroundRepeat = G(e, ti, t.backgroundRepeat), this.backgroundSize = G(e, ii, t.backgroundSize), this.borderTopColor = G(e, si, t.borderTopColor), this.borderRightColor = G(e, ci, t.borderRightColor), this.borderBottomColor = G(e, li, t.borderBottomColor), this.borderLeftColor = G(e, ui, t.borderLeftColor), this.borderTopLeftRadius = G(e, fi, t.borderTopLeftRadius), this.borderTopRightRadius = G(e, pi, t.borderTopRightRadius), this.borderBottomRightRadius = G(e, mi, t.borderBottomRightRadius), this.borderBottomLeftRadius = G(e, hi, t.borderBottomLeftRadius), this.borderTopStyle = G(e, _i, t.borderTopStyle), this.borderRightStyle = G(e, vi, t.borderRightStyle), this.borderBottomStyle = G(e, yi, t.borderBottomStyle), this.borderLeftStyle = G(e, bi, t.borderLeftStyle), this.borderTopWidth = G(e, Si, t.borderTopWidth), this.borderRightWidth = G(e, Ci, t.borderRightWidth), this.borderBottomWidth = G(e, wi, t.borderBottomWidth), this.borderLeftWidth = G(e, Ti, t.borderLeftWidth), this.boxShadow = G(e, Ta, t.boxShadow), this.color = G(e, Ei, t.color), this.direction = G(e, Di, t.direction), this.display = G(e, Oi, t.display), this.float = G(e, Ai, t.cssFloat), this.fontFamily = G(e, ma, t.fontFamily), this.fontSize = G(e, ha, t.fontSize), this.fontStyle = G(e, va, t.fontStyle), this.fontVariant = G(e, _a, t.fontVariant), this.fontWeight = G(e, ga, t.fontWeight), this.letterSpacing = G(e, ji, t.letterSpacing), this.lineBreak = G(e, Ni, t.lineBreak), this.lineHeight = G(e, Pi, t.lineHeight), this.listStyleImage = G(e, Ii, t.listStyleImage), this.listStylePosition = G(e, Li, t.listStylePosition), this.listStyleType = G(e, Ri, t.listStyleType), this.marginTop = G(e, Bi, t.marginTop), this.marginRight = G(e, Vi, t.marginRight), this.marginBottom = G(e, Hi, t.marginBottom), this.marginLeft = G(e, Ui, t.marginLeft), this.opacity = G(e, da, t.opacity);
|
|
2143
2143
|
var n = G(e, Wi, t.overflow);
|
|
2144
|
-
this.overflowX = n[0], this.overflowY = n[n.length > 1
|
|
2144
|
+
this.overflowX = n[0], this.overflowY = n[+(n.length > 1)], this.overflowWrap = G(e, Gi, t.overflowWrap), this.paddingTop = G(e, qi, t.paddingTop), this.paddingRight = G(e, Ji, t.paddingRight), this.paddingBottom = G(e, Yi, t.paddingBottom), this.paddingLeft = G(e, Xi, t.paddingLeft), this.paintOrder = G(e, Ea, t.paintOrder), this.position = G(e, Qi, t.position), this.textAlign = G(e, Zi, t.textAlign), this.textDecorationColor = G(e, fa, t.textDecorationColor ?? t.color), this.textDecorationLine = G(e, pa, t.textDecorationLine ?? t.textDecoration), this.textShadow = G(e, $i, t.textShadow), this.textTransform = G(e, ea, t.textTransform), this.transform = G(e, ta, t.transform), this.transformOrigin = G(e, aa, t.transformOrigin), this.visibility = G(e, oa, t.visibility), this.webkitTextStrokeColor = G(e, Da, t.webkitTextStrokeColor), this.webkitTextStrokeWidth = G(e, Oa, t.webkitTextStrokeWidth), this.wordBreak = G(e, ca, t.wordBreak), this.zIndex = G(e, la, t.zIndex);
|
|
2145
2145
|
}
|
|
2146
2146
|
return e.prototype.isVisible = function() {
|
|
2147
2147
|
return this.display > 0 && this.opacity > 0 && this.visibility === 0;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { default as OfficeColorIcon } from './components/OfficeColorIcon.vue';
|
|
2
2
|
import { default as OfficeIcon } from './components/OfficeIcon.vue';
|
|
3
3
|
import { default as RichTextEditor } from './components/RichTextEditor.vue';
|
|
4
|
+
import { default as RichTextOutline } from './components/RichTextOutline.vue';
|
|
4
5
|
import { default as ScrollArea } from './components/ScrollArea.vue';
|
|
5
|
-
export { OfficeColorIcon, OfficeIcon, RichTextEditor, ScrollArea };
|
|
6
|
+
export { OfficeColorIcon, OfficeIcon, RichTextEditor, RichTextOutline, ScrollArea };
|
|
6
7
|
export { colorIconNames, monoIconNames } from './icons';
|
|
7
|
-
export type { OfficeColorIconProps, OfficeIconProps,
|
|
8
|
+
export type { OfficeColorIconProps, OfficeIconProps, RichTextEditorAlign, RichTextEditorCollectedFilePayload, RichTextEditorFilePayload, RichTextEditorExportItemKey, RichTextEditorImageExportOptions, RichTextEditorImagePayload, RichTextEditorInstance, RichTextEditorInsertMenuItemKey, RichTextEditorLocalFilePayload, RichTextEditorMessages, RichTextEditorMentionItem, RichTextEditorMentionProvider, RichTextEditorMentionProviderPayload, RichTextEditorMentionType, RichTextEditorOutlineChangeHandler, RichTextEditorOutlineItem, RichTextEditorOutlineState, RichTextEditorProps, RichTextEditorToolbarActionKey, RichTextEditorUploadHook, RichTextEditorUploadErrorHandler, RichTextEditorUploadErrorPayload, RichTextEditorUploadInput, RichTextEditorUploadKind, RichTextEditorUploadResult, RichTextEditorWatermarkOptions, RichTextEditorVideoPayload, } from './types';
|
|
8
9
|
export default RichTextEditor;
|