@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.
@@ -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, 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 { RichTextEditorCollaborationOptions, RichTextEditorMentionItem } from '../types';
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
- collaboration?: RichTextEditorCollaborationOptions | null;
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
- 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, 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;
@@ -1,4 +1,4 @@
1
- import { n as e, t } from "./chunk-efA98nb6.js";
1
+ import { n as e, t } from "./chunk-C_CI6nMA.js";
2
2
  import { t as n } from "./typeof-Dz1Ap89p.js";
3
3
  //#region ../../node_modules/core-js/internals/global-this.js
4
4
  var r = /* @__PURE__ */ t(((e, t) => {