@stll/folio-vue 0.26.6 → 0.28.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/dist/{StylePicker-hnZuzLnq.cjs → StylePicker-Bgu0Slqa.cjs} +1 -1
- package/dist/{StylePicker-bQuysXuB.js → StylePicker-CfC5Ef1i.js} +22 -6
- package/dist/components/DocxEditor/DocxEditorMenuBar.vue.d.ts +7 -5
- package/dist/components/DocxEditor.vue.d.ts +15 -13
- package/dist/components/EditorToolbar.vue.d.ts +13 -11
- package/dist/components/TitleBar.vue.d.ts +9 -7
- package/dist/components/Toolbar.vue.d.ts +7 -5
- package/dist/components/ui/Button.vue.d.ts +5 -3
- package/dist/components/ui/Dialog.vue.d.ts +5 -3
- package/dist/components/ui/MenuDropdown.vue.d.ts +8 -6
- package/dist/components/ui/Popover.vue.d.ts +10 -8
- package/dist/composables/useCommentManagement.d.ts +4 -0
- package/dist/composables/useDocxEditor.d.ts +9 -0
- package/dist/composables/useTrackedChanges.d.ts +4 -1
- package/dist/composables.cjs +1 -1
- package/dist/composables.js +1 -1
- package/dist/folio-vue.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1325 -1299
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +1 -1
- package/dist/useZoom-CKHgvyHZ.js +1014 -0
- package/dist/useZoom-Db3Q3xP7.cjs +1 -0
- package/dist/utils/comments.d.ts +11 -1
- package/package.json +4 -4
- package/dist/useZoom-Bwnae1jX.cjs +0 -1
- package/dist/useZoom-C_7cmUyk.js +0 -988
|
@@ -2,21 +2,23 @@ import { Comment } from '@stll/folio-core/types/content';
|
|
|
2
2
|
import { Document } from '@stll/folio-core/types/document';
|
|
3
3
|
import { FindResult } from '@stll/folio-core/utils/findReplace';
|
|
4
4
|
import { DocxEditorProps, EditorMode } from './DocxEditor/types';
|
|
5
|
-
declare
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} & {
|
|
9
|
-
|
|
10
|
-
} & {
|
|
11
|
-
|
|
12
|
-
} & {
|
|
13
|
-
|
|
14
|
-
} & {
|
|
15
|
-
|
|
5
|
+
declare const __VLS_template: () => {
|
|
6
|
+
__VLS_Slots: {
|
|
7
|
+
'title-bar-left'?: (props: {}) => any;
|
|
8
|
+
} & {
|
|
9
|
+
'title-bar-right'?: (props: {}) => any;
|
|
10
|
+
} & {
|
|
11
|
+
'toolbar-extra'?: (props: {}) => any;
|
|
12
|
+
} & {
|
|
13
|
+
'loading-indicator'?: (props: {}) => any;
|
|
14
|
+
} & {
|
|
15
|
+
placeholder?: (props: {}) => any;
|
|
16
|
+
};
|
|
16
17
|
};
|
|
18
|
+
type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
17
19
|
declare const __VLS_base: import('vue').DefineComponent<DocxEditorProps, import('..').DocxEditorRef, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
18
|
-
error: (error: Error) => any;
|
|
19
20
|
change: (doc: Document) => any;
|
|
21
|
+
error: (error: Error) => any;
|
|
20
22
|
ready: () => any;
|
|
21
23
|
rename: (name: string) => any;
|
|
22
24
|
"menu-action": (action: string) => any;
|
|
@@ -25,8 +27,8 @@ declare const __VLS_base: import('vue').DefineComponent<DocxEditorProps, import(
|
|
|
25
27
|
"comments-change": (comments: Comment[]) => any;
|
|
26
28
|
"find-result-change": (result: FindResult | null) => any;
|
|
27
29
|
}, string, import('vue').PublicProps, Readonly<DocxEditorProps> & Readonly<{
|
|
28
|
-
onError?: (error: Error) => any;
|
|
29
30
|
onChange?: (doc: Document) => any;
|
|
31
|
+
onError?: (error: Error) => any;
|
|
30
32
|
onReady?: () => any;
|
|
31
33
|
onRename?: (name: string) => any;
|
|
32
34
|
"onMenu-action"?: (action: string) => any;
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
showMenuBar?: boolean;
|
|
3
3
|
};
|
|
4
|
-
declare
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} & {
|
|
8
|
-
|
|
9
|
-
} & {
|
|
10
|
-
|
|
11
|
-
} & {
|
|
12
|
-
|
|
13
|
-
} & {
|
|
14
|
-
|
|
4
|
+
declare const __VLS_template: () => {
|
|
5
|
+
__VLS_Slots: {
|
|
6
|
+
'title-bar'?: (props: {}) => any;
|
|
7
|
+
} & {
|
|
8
|
+
'title-bar-left'?: (props: {}) => any;
|
|
9
|
+
} & {
|
|
10
|
+
'document-name'?: (props: {}) => any;
|
|
11
|
+
} & {
|
|
12
|
+
'title-bar-right'?: (props: {}) => any;
|
|
13
|
+
} & {
|
|
14
|
+
toolbar?: (props: {}) => any;
|
|
15
|
+
};
|
|
15
16
|
};
|
|
17
|
+
type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
16
18
|
declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
17
19
|
"menu-action": (action: string) => any;
|
|
18
20
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} & {
|
|
5
|
-
|
|
6
|
-
} & {
|
|
7
|
-
|
|
1
|
+
declare const __VLS_template: () => {
|
|
2
|
+
__VLS_Slots: {
|
|
3
|
+
left?: (props: {}) => any;
|
|
4
|
+
} & {
|
|
5
|
+
default?: (props: {}) => any;
|
|
6
|
+
} & {
|
|
7
|
+
right?: (props: {}) => any;
|
|
8
|
+
};
|
|
8
9
|
};
|
|
10
|
+
type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
9
11
|
declare const __VLS_base: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
10
12
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
13
|
declare const _default: typeof __VLS_export;
|
|
@@ -71,12 +71,14 @@ type __VLS_Props = {
|
|
|
71
71
|
matching React's Toolbar `documentStyles` prop. Falls back to presets. */
|
|
72
72
|
documentStyles?: Style[];
|
|
73
73
|
};
|
|
74
|
-
declare
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
} & {
|
|
78
|
-
|
|
74
|
+
declare const __VLS_template: () => {
|
|
75
|
+
__VLS_Slots: {
|
|
76
|
+
'table-context'?: (props: {}) => any;
|
|
77
|
+
} & {
|
|
78
|
+
'toolbar-extra'?: (props: {}) => any;
|
|
79
|
+
};
|
|
79
80
|
};
|
|
81
|
+
type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
80
82
|
declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
81
83
|
"zoom-in": () => any;
|
|
82
84
|
"zoom-out": () => any;
|
|
@@ -6,10 +6,12 @@ type __VLS_Props = {
|
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
className?: string;
|
|
8
8
|
};
|
|
9
|
-
declare
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
declare const __VLS_template: () => {
|
|
10
|
+
__VLS_Slots: {
|
|
11
|
+
default?: (props: {}) => any;
|
|
12
|
+
};
|
|
12
13
|
};
|
|
14
|
+
type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
13
15
|
declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
14
16
|
click: (evt: MouseEvent) => any;
|
|
15
17
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
@@ -5,10 +5,12 @@ type __VLS_Props = {
|
|
|
5
5
|
backdropClass?: string;
|
|
6
6
|
closeOnBackdrop?: boolean;
|
|
7
7
|
};
|
|
8
|
-
declare
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
declare const __VLS_template: () => {
|
|
9
|
+
__VLS_Slots: {
|
|
10
|
+
default?: (props: {}) => any;
|
|
11
|
+
};
|
|
11
12
|
};
|
|
13
|
+
type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
12
14
|
declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
13
15
|
close: () => any;
|
|
14
16
|
"update:open": (value: boolean) => any;
|
|
@@ -22,13 +22,15 @@ type __VLS_Props = {
|
|
|
22
22
|
showChevron?: boolean;
|
|
23
23
|
};
|
|
24
24
|
declare function closeMenu(): void;
|
|
25
|
-
declare
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
declare const __VLS_template: () => {
|
|
26
|
+
__VLS_Slots: {
|
|
27
|
+
submenu?: (props: {
|
|
28
|
+
item: MenuItem;
|
|
29
|
+
closeMenu: typeof closeMenu;
|
|
30
|
+
}) => any;
|
|
31
|
+
};
|
|
31
32
|
};
|
|
33
|
+
type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
32
34
|
declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
33
35
|
showChevron: boolean;
|
|
34
36
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
@@ -11,15 +11,17 @@ type __VLS_Props = {
|
|
|
11
11
|
closeOnScroll?: boolean;
|
|
12
12
|
};
|
|
13
13
|
declare function toggle(): void;
|
|
14
|
-
declare
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} & {
|
|
21
|
-
|
|
14
|
+
declare const __VLS_template: () => {
|
|
15
|
+
__VLS_Slots: {
|
|
16
|
+
trigger?: (props: {
|
|
17
|
+
toggle: typeof toggle;
|
|
18
|
+
open: boolean;
|
|
19
|
+
}) => any;
|
|
20
|
+
} & {
|
|
21
|
+
panel?: (props: {}) => any;
|
|
22
|
+
};
|
|
22
23
|
};
|
|
24
|
+
type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
|
|
23
25
|
declare const __VLS_base: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
24
26
|
close: () => any;
|
|
25
27
|
"update:open": (value: boolean) => any;
|
|
@@ -16,6 +16,10 @@ export type UseCommentManagementOptions = {
|
|
|
16
16
|
canonicalTick?: Ref<number>;
|
|
17
17
|
/** Re-run layout after a mutation that changed marks in the document. */
|
|
18
18
|
reLayout: () => void;
|
|
19
|
+
/** Whether the editor is read-only; user comment edits are then refused. */
|
|
20
|
+
readOnly: () => boolean;
|
|
21
|
+
/** Report a refused edit to the host. */
|
|
22
|
+
onReadOnlyEditAttempt: () => void;
|
|
19
23
|
};
|
|
20
24
|
export type UseCommentManagementReturn = {
|
|
21
25
|
comments: ComputedRef<Comment[]>;
|
|
@@ -15,9 +15,16 @@ import { HistoryShortcutOwner } from '@stll/folio-core/prosemirror/extensions/co
|
|
|
15
15
|
import { CommandMap } from '@stll/folio-core/prosemirror/extensions/types';
|
|
16
16
|
import { AnonymizationMatch } from '@stll/folio-core/prosemirror/plugins/anonymizationDecorations';
|
|
17
17
|
import { TemplateSlashMenuKeyAction, TemplateSlashMenuState } from '@stll/folio-core/prosemirror/plugins/templateSlashMenu';
|
|
18
|
+
import { Comment } from '@stll/folio-core/types/content';
|
|
18
19
|
import { Document } from '@stll/folio-core/types/document';
|
|
19
20
|
import { DocxInput } from '@stll/folio-core/utils/docxInput';
|
|
20
21
|
export type UseDocxEditorOptions = {
|
|
22
|
+
/**
|
|
23
|
+
* The comment threads the host keeps beside the editor. Saving writes them
|
|
24
|
+
* into the document; without it the saved document keeps the threads it was
|
|
25
|
+
* loaded with.
|
|
26
|
+
*/
|
|
27
|
+
comments?: () => readonly Comment[];
|
|
21
28
|
/** Container element that hosts the off-screen ProseMirror editor. */
|
|
22
29
|
hiddenContainer: Ref<HTMLElement | null>;
|
|
23
30
|
/** Optional separate host for persistent header/footer ProseMirror views. */
|
|
@@ -41,6 +48,8 @@ export type UseDocxEditorOptions = {
|
|
|
41
48
|
markupView?: MaybeRefOrGetter<DisplayMode>;
|
|
42
49
|
/** Paint comment highlights in All Markup. Defaults to true. Reactive. */
|
|
43
50
|
showCommentHighlights?: MaybeRefOrGetter<boolean>;
|
|
51
|
+
/** Localised text for a `w:altChunk` that has no text of its own to show. */
|
|
52
|
+
altChunkMarkerText?: MaybeRefOrGetter<string>;
|
|
44
53
|
showMarginGuides?: MaybeRefOrGetter<boolean | undefined>;
|
|
45
54
|
/** CSS color used for margin guides. Reactive. */
|
|
46
55
|
marginGuideColor?: MaybeRefOrGetter<string | undefined>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EditorView } from 'prosemirror-view';
|
|
2
2
|
import { Ref } from 'vue';
|
|
3
3
|
import { extractTrackedChanges, TrackedChangesResult } from '@stll/folio-core/prosemirror/utils/extractTrackedChanges';
|
|
4
|
+
import { TrackedChangeEntry } from '../utils/comments';
|
|
4
5
|
export type { TrackedChangesResult };
|
|
5
6
|
export { extractTrackedChanges };
|
|
6
7
|
export type { TrackedChangeEntry } from '../utils/comments';
|
|
@@ -9,4 +10,6 @@ export type { TrackedChangeEntry } from '../utils/comments';
|
|
|
9
10
|
* transaction (the same tick the Toolbar listens to). The computed
|
|
10
11
|
* re-runs whenever the tick advances.
|
|
11
12
|
*/
|
|
12
|
-
export declare function useTrackedChanges(view: Ref<EditorView | null>, stateTick: Ref<number>): import('vue').ComputedRef<TrackedChangesResult
|
|
13
|
+
export declare function useTrackedChanges(view: Ref<EditorView | null>, stateTick: Ref<number>): import('vue').ComputedRef<TrackedChangesResult & {
|
|
14
|
+
entries: TrackedChangeEntry[];
|
|
15
|
+
}>;
|
package/dist/composables.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useZoom-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useZoom-Db3Q3xP7.cjs");let t=require("vue"),n=require("@stll/folio-core/utils/textEncoding"),r=require("prosemirror-history"),i=require("@stll/folio-core/utils/documentPointerDown"),a=require("@stll/folio-core/managers/ClipboardManager"),o=require("@stll/folio-core/utils/clipboard"),s=require("@stll/folio-core/managers/TableSelectionManager"),c=require("@stll/folio-core/prosemirror/utils/visualLineNavigation"),l=require("@stll/folio-core/prosemirror/utils/extractTrackedChanges");function u(e={}){let{onCopy:r,onCut:i,onPaste:a,cleanWordFormatting:s=!0,editable:c=!0,onError:l}=e,u=(0,t.ref)(!1),d=(0,t.ref)(null),f=l?{onError:l}:{};async function p(e){if(u.value)return!1;u.value=!0;try{let t=await(0,o.copyRuns)(e.runs,f);return t&&r?.(e),t}finally{u.value=!1}}async function m(e){if(u.value||!c)return!1;u.value=!0;try{let t=await(0,o.copyRuns)(e.runs,f);return t&&i?.(e),t}finally{u.value=!1}}async function h(e=!1){if(u.value||!c)return null;u.value=!0;try{if(navigator.clipboard&&navigator.clipboard.read){let t=await navigator.clipboard.read(),r=``,i=``;for(let e of t)e.types.includes(`text/html`)&&(r=await(0,n.readBlobText)(await e.getType(`text/html`))),e.types.includes(`text/plain`)&&(i=await(0,n.readBlobText)(await e.getType(`text/plain`)));e&&(r=``);let c=(0,o.parseClipboardHtml)(r,i,s);return d.value=c,a?.(c,e),c}return null}catch(e){return l?.(e instanceof Error?e:Error(String(e))),null}finally{u.value=!1}}return{copy:p,cut:m,paste:h,isProcessing:u,lastPastedContent:d}}function d({isOpen:e,onClose:n,align:r=`left`}){let a=(0,t.ref)(null),o=(0,t.ref)(null),s=(0,t.ref)({position:`fixed`,top:`0px`,left:`0px`,zIndex:1e4});function c(e,t){s.value={position:`fixed`,top:e+`px`,left:t+`px`,zIndex:1e4}}function l(e){let t=e.target;t instanceof Node&&a.value&&!a.value.contains(t)&&o.value&&!o.value.contains(t)&&n()}function u(e){e.key===`Escape`&&n()}function d(e){let t=e.target;t instanceof Node&&o.value&&o.value.contains(t)||n()}let f;function p(){f=(0,i.onDocumentPointerDown)(document,l),document.addEventListener(`keydown`,u),window.addEventListener(`scroll`,d,!0)}function m(){f?.(),f=void 0,document.removeEventListener(`keydown`,u),window.removeEventListener(`scroll`,d,!0)}(0,t.watch)(e,e=>{if(!e){m();return}let t=a.value;if(!t)return;let n=t.getBoundingClientRect();r===`right`?requestAnimationFrame(()=>{let e=o.value;if(e){let t=e.getBoundingClientRect();c(n.bottom+4,n.right-t.width)}else c(n.bottom+4,n.left)}):c(n.bottom+4,n.left),p()}),(0,t.onScopeDispose)(m);function h(e){e.preventDefault(),e.stopPropagation()}return{containerRef:a,dropdownRef:o,dropdownStyle:s,handleMouseDown:h}}function f(e,n){let i=(0,t.computed)(()=>{n.value;let t=e.value;return t?(0,r.undoDepth)(t.state)>0:!1}),a=(0,t.computed)(()=>{n.value;let t=e.value;return t?(0,r.redoDepth)(t.state)>0:!1});function o(){let t=e.value;return t?(0,r.undo)(t.state,t.dispatch):!1}function s(){let t=e.value;return t?(0,r.redo)(t.state,t.dispatch):!1}return{canUndo:i,canRedo:a,undo:o,redo:s}}var p={backgroundColor:`rgba(26, 115, 232, 0.3)`,borderRadius:0,zIndex:0,opacity:1,mixBlendMode:`multiply`};function m(e){let t=window.getSelection();if(!t||t.rangeCount===0||t.isCollapsed)return[];let n=t.getRangeAt(0);if(e&&!e.contains(n.commonAncestorContainer))return[];let r=0,i=0;if(e){let t=e.getBoundingClientRect();r=t.left+e.scrollLeft,i=t.top+e.scrollTop}let a=[];for(let e of n.getClientRects())(e.width!==0||e.height!==0)&&a.push({left:e.left-r,top:e.top-i,width:e.width,height:e.height});return a}function h(e,t=2){if(e.length<=1)return e;let n=[...e].sort((e,n)=>Math.abs(e.top-n.top)<t?e.left-n.left:e.top-n.top),r=n[0];if(!r)return e;let i=[],a={...r};for(let e=1;e<n.length;e++){let r=n[e];if(!r)continue;let o=Math.abs(r.top-a.top)<t,s=r.left<=a.left+a.width+t;if(o&&s){let e=Math.max(a.left+a.width,r.left+r.width);a.width=e-a.left,a.height=Math.max(a.height,r.height)}else i.push(a),a={...r}}return i.push(a),i}function g(e){return h(m(e))}function _(){let e=window.getSelection();return e!==null&&!e.isCollapsed&&e.rangeCount>0}function v(e){let t=window.getSelection();return!t||t.rangeCount===0?!1:e.contains(t.getRangeAt(0).commonAncestorContainer)}var y=`docx-selection-styles`,b=null;function x(){b&&=(b.remove(),null),document.getElementById(y)?.remove()}function S(e=p){x();let t=`
|
|
2
2
|
/* DOCX Editor Selection Highlighting */
|
|
3
3
|
|
|
4
4
|
.docx-editor [contenteditable="true"]::selection,
|
package/dist/composables.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "./useZoom-
|
|
1
|
+
import { a as e, c as t, d as n, i as r, l as i, n as a, o, r as s, s as c, t as l, u } from "./useZoom-CKHgvyHZ.js";
|
|
2
2
|
import { computed as d, onBeforeUnmount as f, onMounted as p, onScopeDispose as m, ref as h, watch as g } from "vue";
|
|
3
3
|
import { readBlobText as _ } from "@stll/folio-core/utils/textEncoding";
|
|
4
4
|
import { redo as v, redoDepth as y, undo as b, undoDepth as x } from "prosemirror-history";
|