@norio-office/rich-text 0.1.0 → 0.6.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.
@@ -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: boolean;
3
- placement: 'left' | 'right';
4
- collapseTitle: string;
5
- emptyDescription: string;
6
- emptyTip: string;
7
- items: Array<{
8
- pos: number;
9
- level: number;
10
- text: string;
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
- }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLElement>;
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, RichTextEditorCommentCreatePayload, RichTextEditorCommentDeletePayload, RichTextEditorCommentMentionProviderPayload, RichTextEditorCommentReplyPayload, RichTextEditorCommentResolvePayload, RichTextEditorCommentSubmitPayload, RichTextEditorCommentThread, RichTextEditorCommentUpdatePayload, RichTextEditorCommentUser, 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,77 @@ 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;
23
+ focusCommentThread: (threadId: string) => boolean;
15
24
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
16
25
  change: (value: JSONContent) => any;
17
26
  "update:modelValue": (value: JSONContent) => any;
18
27
  "local-file-upload": (value: RichTextEditorLocalFilePayload) => any;
28
+ "local-file-click": (value: RichTextEditorLocalFilePayload) => any;
19
29
  "local-file-download": (value: RichTextEditorLocalFilePayload) => any;
30
+ "upload-error": (value: RichTextEditorUploadErrorPayload) => any;
20
31
  "mention-item-click": (value: RichTextEditorMentionItem) => any;
21
32
  "mention-submit": (value: RichTextEditorMentionItem) => any;
33
+ "outline-change": (value: RichTextEditorOutlineState) => any;
34
+ "comment-create": (value: RichTextEditorCommentCreatePayload) => any;
35
+ "comment-reply": (value: RichTextEditorCommentReplyPayload) => any;
36
+ "comment-update": (value: RichTextEditorCommentUpdatePayload) => any;
37
+ "comment-delete": (value: RichTextEditorCommentDeletePayload) => any;
38
+ "comment-resolve": (value: RichTextEditorCommentResolvePayload) => any;
39
+ "comment-select": (value: RichTextEditorCommentThread) => any;
40
+ "comment-submit": (value: RichTextEditorCommentSubmitPayload) => any;
41
+ "comment-mention-search": (value: RichTextEditorCommentMentionProviderPayload) => any;
42
+ "comment-mention-item-click": (value: RichTextEditorMentionItem) => any;
43
+ "comment-mention-submit": (value: RichTextEditorMentionItem) => any;
22
44
  }, string, import('vue').PublicProps, Readonly<RichTextEditorProps> & Readonly<{
23
45
  onChange?: ((value: JSONContent) => any) | undefined;
24
46
  "onUpdate:modelValue"?: ((value: JSONContent) => any) | undefined;
25
47
  "onLocal-file-upload"?: ((value: RichTextEditorLocalFilePayload) => any) | undefined;
48
+ "onLocal-file-click"?: ((value: RichTextEditorLocalFilePayload) => any) | undefined;
26
49
  "onLocal-file-download"?: ((value: RichTextEditorLocalFilePayload) => any) | undefined;
50
+ "onUpload-error"?: ((value: RichTextEditorUploadErrorPayload) => any) | undefined;
27
51
  "onMention-item-click"?: ((value: RichTextEditorMentionItem) => any) | undefined;
28
52
  "onMention-submit"?: ((value: RichTextEditorMentionItem) => any) | undefined;
53
+ "onOutline-change"?: ((value: RichTextEditorOutlineState) => any) | undefined;
54
+ "onComment-create"?: ((value: RichTextEditorCommentCreatePayload) => any) | undefined;
55
+ "onComment-reply"?: ((value: RichTextEditorCommentReplyPayload) => any) | undefined;
56
+ "onComment-update"?: ((value: RichTextEditorCommentUpdatePayload) => any) | undefined;
57
+ "onComment-delete"?: ((value: RichTextEditorCommentDeletePayload) => any) | undefined;
58
+ "onComment-resolve"?: ((value: RichTextEditorCommentResolvePayload) => any) | undefined;
59
+ "onComment-select"?: ((value: RichTextEditorCommentThread) => any) | undefined;
60
+ "onComment-submit"?: ((value: RichTextEditorCommentSubmitPayload) => any) | undefined;
61
+ "onComment-mention-search"?: ((value: RichTextEditorCommentMentionProviderPayload) => any) | undefined;
62
+ "onComment-mention-item-click"?: ((value: RichTextEditorMentionItem) => any) | undefined;
63
+ "onComment-mention-submit"?: ((value: RichTextEditorMentionItem) => any) | undefined;
29
64
  }>, {
30
65
  placeholder: string;
31
66
  mode: "edit" | "preview";
67
+ mention: boolean;
32
68
  editable: boolean;
69
+ uploadImage: import('..').RichTextEditorUploadHook | null;
70
+ onUploadError: import('..').RichTextEditorUploadErrorHandler | null;
71
+ uploadVideo: import('..').RichTextEditorUploadHook | null;
33
72
  modelValue: JSONContent | null;
73
+ documentName: string;
74
+ watermark: RichTextEditorWatermarkOptions | null;
75
+ showOutline: boolean;
34
76
  outlinePlacement: "left" | "right";
35
77
  messages: import('..').RichTextEditorMessages | null;
78
+ comments: RichTextEditorCommentThread[] | null;
79
+ commentUser: RichTextEditorCommentUser | null;
80
+ showComments: boolean;
81
+ commentMention: boolean;
82
+ uploadFile: import('..').RichTextEditorUploadHook | null;
83
+ uploadCommentImage: import('..').RichTextEditorUploadHook | null;
84
+ commentMentionProvider: import('..').RichTextEditorCommentMentionProvider | null;
85
+ onCommentMentionSearch: import('..').RichTextEditorCommentMentionProvider | null;
36
86
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
37
87
  rootRef: HTMLDivElement;
38
88
  insertMenuRef: HTMLDivElement;
@@ -63,7 +113,12 @@ declare const _default: import('vue').DefineComponent<RichTextEditorProps, {
63
113
  countdownBubbleEditButtonRef: HTMLButtonElement;
64
114
  mentionPanelRef: HTMLDivElement;
65
115
  blockSideColorPickerRef: HTMLInputElement;
116
+ commentPanelRef: HTMLElement;
117
+ commentMentionPanelRef: HTMLDivElement;
66
118
  markdownImportInputRef: HTMLInputElement;
67
119
  localFileInputRef: HTMLInputElement;
120
+ imageUploadInputRef: HTMLInputElement;
121
+ videoUploadInputRef: HTMLInputElement;
122
+ commentImageInputRef: HTMLInputElement;
68
123
  }, HTMLDivElement>;
69
124
  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,16 @@
1
1
  import { JSONContent } from '@tiptap/core';
2
- import { RichTextEditorCollaborationOptions, RichTextEditorMentionItem } from '../types';
2
+ import { Ref } from 'vue';
3
+ import { RichTextEditorCollaborationOptions, RichTextEditorLocalFilePayload, RichTextEditorMentionItem, RichTextEditorUploadErrorHandler, RichTextEditorUploadHook } from '../types';
3
4
  type UseRichTextEditorOptions = {
4
5
  content: JSONContent;
5
6
  editable: boolean;
6
7
  placeholder: string;
7
8
  collaboration?: RichTextEditorCollaborationOptions | null;
9
+ uploadImage?: RichTextEditorUploadHook | Ref<RichTextEditorUploadHook | null | undefined> | null;
10
+ uploadVideo?: RichTextEditorUploadHook | Ref<RichTextEditorUploadHook | null | undefined> | null;
11
+ onUploadError?: RichTextEditorUploadErrorHandler | Ref<RichTextEditorUploadErrorHandler | null | undefined> | null;
12
+ mention?: boolean | Ref<boolean | undefined> | null;
13
+ onLocalFileClick?: (payload: RichTextEditorLocalFilePayload) => void;
8
14
  onLocalFileDownload?: (payload: {
9
15
  url: string;
10
16
  name: string;
@@ -0,0 +1,2 @@
1
+ import { Mark } from '@tiptap/core';
2
+ export declare const CommentMark: Mark<any, any>;
@@ -1,2 +1,8 @@
1
1
  import { Node } from '@tiptap/core';
2
- export declare const ImageBlock: Node<any, any>;
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
- export declare const VideoBlock: Node<any, any>;
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-efA98nb6.js";
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 ? 1 : 0], 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);
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, RichTextEditorCollaborationAwareness, RichTextEditorCollaborationDocument, RichTextEditorCollaborationOptions, RichTextEditorCollaborationProvider, RichTextEditorCollaborationUser, RichTextEditorFilePayload, RichTextEditorExportItemKey, RichTextEditorImageExportOptions, RichTextEditorImagePayload, RichTextEditorInstance, RichTextEditorInsertMenuItemKey, RichTextEditorLocalFilePayload, RichTextEditorMessages, RichTextEditorMentionItem, RichTextEditorMentionProvider, RichTextEditorMentionProviderPayload, RichTextEditorMentionType, RichTextEditorProps, RichTextEditorToolbarActionKey, RichTextEditorVideoPayload, } from './types';
8
+ export type { OfficeColorIconProps, OfficeIconProps, RichTextEditorAlign, RichTextEditorCollaborationAwareness, RichTextEditorCollaborationDocument, RichTextEditorCollaborationOptions, RichTextEditorCollaborationProvider, RichTextEditorCollaborationUser, RichTextEditorCommentCreatePayload, RichTextEditorCommentDeletePayload, RichTextEditorCommentImage, RichTextEditorCommentItem, RichTextEditorCommentMentionItem, RichTextEditorCommentMentionProvider, RichTextEditorCommentMentionProviderPayload, RichTextEditorCommentReplyPayload, RichTextEditorCommentResolvePayload, RichTextEditorCommentSubmitPayload, RichTextEditorCommentThread, RichTextEditorCommentUpdatePayload, RichTextEditorCommentUser, 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;