@univerjs/docs-quick-insert-ui 0.6.7 → 0.6.9-nightly.202504021607
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/cjs/index.js +7 -5
- package/lib/es/index.js +420 -345
- package/lib/index.css +1 -1
- package/lib/index.js +668 -0
- package/lib/locale/en-US.js +18 -0
- package/lib/locale/fa-IR.js +18 -0
- package/lib/locale/fr-FR.js +18 -0
- package/lib/locale/ru-RU.js +18 -0
- package/lib/locale/vi-VN.js +18 -0
- package/lib/locale/zh-CN.js +18 -0
- package/lib/locale/zh-TW.js +18 -0
- package/lib/types/controllers/doc-quick-insert-trigger.controller.d.ts +3 -2
- package/lib/types/services/doc-quick-insert-popup.service.d.ts +9 -1
- package/lib/umd/index.js +7 -5
- package/package.json +13 -13
- package/LICENSE +0 -176
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
docQuickInsert: {
|
|
3
|
+
menu: {
|
|
4
|
+
numberedList: "Numbered List",
|
|
5
|
+
bulletedList: "Bulleted List",
|
|
6
|
+
divider: "Divider",
|
|
7
|
+
text: "Text"
|
|
8
|
+
},
|
|
9
|
+
group: {
|
|
10
|
+
basics: "Basics"
|
|
11
|
+
},
|
|
12
|
+
placeholder: "No results found",
|
|
13
|
+
keywordInputPlaceholder: "Enter keywords"
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
e as default
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
docQuickInsert: {
|
|
3
|
+
menu: {
|
|
4
|
+
numberedList: "لیست شمارهدار",
|
|
5
|
+
bulletedList: "لیست نقطهدار",
|
|
6
|
+
divider: "خط تقسیم",
|
|
7
|
+
text: "متن"
|
|
8
|
+
},
|
|
9
|
+
group: {
|
|
10
|
+
basics: "بنیادی"
|
|
11
|
+
},
|
|
12
|
+
placeholder: "هیچ نتیجهای یافت نشد",
|
|
13
|
+
keywordInputPlaceholder: "وارد کلمات کلیدی"
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
e as default
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
docQuickInsert: {
|
|
3
|
+
menu: {
|
|
4
|
+
numberedList: "Liste numérotée",
|
|
5
|
+
bulletedList: "Liste à puces",
|
|
6
|
+
divider: "Ligne de séparation",
|
|
7
|
+
text: "Texte"
|
|
8
|
+
},
|
|
9
|
+
group: {
|
|
10
|
+
basics: "Basiques"
|
|
11
|
+
},
|
|
12
|
+
placeholder: "Aucun résultat",
|
|
13
|
+
keywordInputPlaceholder: "Entrez des mots clés"
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
e as default
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
docQuickInsert: {
|
|
3
|
+
menu: {
|
|
4
|
+
numberedList: "Список с нумерацией",
|
|
5
|
+
bulletedList: "Маркированный список",
|
|
6
|
+
divider: "Разделительная линия",
|
|
7
|
+
text: "Текст"
|
|
8
|
+
},
|
|
9
|
+
group: {
|
|
10
|
+
basics: "Основные"
|
|
11
|
+
},
|
|
12
|
+
placeholder: "Нет результатов",
|
|
13
|
+
keywordInputPlaceholder: "Введите ключевые слова"
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
e as default
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
docQuickInsert: {
|
|
3
|
+
menu: {
|
|
4
|
+
numberedList: "Danh sách được đánh số",
|
|
5
|
+
bulletedList: "Danh sách không được đánh số",
|
|
6
|
+
divider: "Đường phân cách",
|
|
7
|
+
text: "Văn bản"
|
|
8
|
+
},
|
|
9
|
+
group: {
|
|
10
|
+
basics: "Cơ bản"
|
|
11
|
+
},
|
|
12
|
+
placeholder: "Không có kết quả",
|
|
13
|
+
keywordInputPlaceholder: "Nhập từ khóa"
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
e as default
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
docQuickInsert: {
|
|
3
|
+
menu: {
|
|
4
|
+
numberedList: "有序列表",
|
|
5
|
+
bulletedList: "无序列表",
|
|
6
|
+
divider: "分隔线",
|
|
7
|
+
text: "文本"
|
|
8
|
+
},
|
|
9
|
+
group: {
|
|
10
|
+
basics: "基础"
|
|
11
|
+
},
|
|
12
|
+
placeholder: "暂无结果",
|
|
13
|
+
keywordInputPlaceholder: "输入关键词"
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
e as default
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
docQuickInsert: {
|
|
3
|
+
menu: {
|
|
4
|
+
numberedList: "有序列表",
|
|
5
|
+
bulletedList: "無序列表",
|
|
6
|
+
divider: "分隔線",
|
|
7
|
+
text: "文本"
|
|
8
|
+
},
|
|
9
|
+
group: {
|
|
10
|
+
basics: "基礎"
|
|
11
|
+
},
|
|
12
|
+
placeholder: "無結果",
|
|
13
|
+
keywordInputPlaceholder: "輸入關鍵詞"
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
e as default
|
|
18
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Disposable, ICommandService } from '@univerjs/core';
|
|
1
|
+
import { Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
|
|
2
2
|
import { DocSelectionManagerService } from '@univerjs/docs';
|
|
3
3
|
import { IShortcutService } from '@univerjs/ui';
|
|
4
4
|
import { DocQuickInsertPopupService } from '../services/doc-quick-insert-popup.service';
|
|
@@ -7,7 +7,8 @@ export declare class DocQuickInsertTriggerController extends Disposable {
|
|
|
7
7
|
private readonly _textSelectionManagerService;
|
|
8
8
|
private readonly _docQuickInsertPopupService;
|
|
9
9
|
private readonly _shortcutService;
|
|
10
|
-
|
|
10
|
+
private readonly _univerInstanceService;
|
|
11
|
+
constructor(_commandService: ICommandService, _textSelectionManagerService: DocSelectionManagerService, _docQuickInsertPopupService: DocQuickInsertPopupService, _shortcutService: IShortcutService, _univerInstanceService: IUniverInstanceService);
|
|
11
12
|
private _initTrigger;
|
|
12
13
|
private _initMenuHandler;
|
|
13
14
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { IDisposable, Nullable, Disposable, ICommandService, IUniverInstanceService } from '@univerjs/core';
|
|
2
2
|
import { IInsertCommandParams, DocCanvasPopManagerService } from '@univerjs/docs-ui';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
|
+
import { DocSelectionManagerService } from '@univerjs/docs';
|
|
5
|
+
import { IRenderManagerService } from '@univerjs/engine-render';
|
|
4
6
|
export interface IDocPopupGroupItem {
|
|
5
7
|
id: string;
|
|
6
8
|
icon?: string;
|
|
@@ -24,6 +26,8 @@ export declare class DocQuickInsertPopupService extends Disposable {
|
|
|
24
26
|
private readonly _docCanvasPopupManagerService;
|
|
25
27
|
private readonly _univerInstanceService;
|
|
26
28
|
private readonly _commandService;
|
|
29
|
+
private readonly _renderManagerService;
|
|
30
|
+
private readonly _docSelectionManagerService;
|
|
27
31
|
private readonly _popups;
|
|
28
32
|
private readonly _editPopup$;
|
|
29
33
|
readonly editPopup$: Observable<Nullable<{
|
|
@@ -38,6 +42,10 @@ export declare class DocQuickInsertPopupService extends Disposable {
|
|
|
38
42
|
disposable: IDisposable;
|
|
39
43
|
unitId: string;
|
|
40
44
|
}>;
|
|
45
|
+
private readonly _isComposing$;
|
|
46
|
+
readonly isComposing$: Observable<boolean>;
|
|
47
|
+
get isComposing(): boolean;
|
|
48
|
+
setIsComposing(isComposing: boolean): void;
|
|
41
49
|
private readonly _inputOffset$;
|
|
42
50
|
readonly inputOffset$: Observable<{
|
|
43
51
|
start: number;
|
|
@@ -54,7 +62,7 @@ export declare class DocQuickInsertPopupService extends Disposable {
|
|
|
54
62
|
readonly filterKeyword$: Observable<string>;
|
|
55
63
|
private _menuSelectedCallbacks;
|
|
56
64
|
private _inputPlaceholderRenderRoot;
|
|
57
|
-
constructor(_docCanvasPopupManagerService: DocCanvasPopManagerService, _univerInstanceService: IUniverInstanceService, _commandService: ICommandService);
|
|
65
|
+
constructor(_docCanvasPopupManagerService: DocCanvasPopManagerService, _univerInstanceService: IUniverInstanceService, _commandService: ICommandService, _renderManagerService: IRenderManagerService, _docSelectionManagerService: DocSelectionManagerService);
|
|
58
66
|
resolvePopup(keyword: string): IDocPopup | undefined;
|
|
59
67
|
registerPopup(popup: IDocPopup): () => void;
|
|
60
68
|
private _createInputPlaceholderRenderRoot;
|
package/lib/umd/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
(function(o,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("@univerjs/docs-drawing"),require("@univerjs/drawing"),require("@univerjs/drawing-ui"),require("@univerjs/ui"),require("@univerjs/docs"),require("@univerjs/docs-ui"),require("rxjs"),require("react/jsx-runtime"),require("@univerjs/design"),require("react")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/docs-drawing","@univerjs/drawing","@univerjs/drawing-ui","@univerjs/ui","@univerjs/docs","@univerjs/docs-ui","rxjs","react/jsx-runtime","@univerjs/design","react"],s):(o=typeof globalThis<"u"?globalThis:o||self,s(o.UniverDocsQuickInsertUi={},o.UniverCore,o.UniverDocsDrawing,o.UniverDrawing,o.UniverDrawingUi,o.UniverUi,o.UniverDocs,o.UniverDocsUi,o.rxjs,o.React,o.UniverDesign,o.React))})(this,function(o,s,
|
|
1
|
+
(function(o,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@univerjs/core"),require("@univerjs/docs-drawing"),require("@univerjs/drawing"),require("@univerjs/drawing-ui"),require("@univerjs/ui"),require("@univerjs/docs"),require("@univerjs/docs-ui"),require("@univerjs/engine-render"),require("rxjs"),require("react/jsx-runtime"),require("@univerjs/design"),require("react")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/docs-drawing","@univerjs/drawing","@univerjs/drawing-ui","@univerjs/ui","@univerjs/docs","@univerjs/docs-ui","@univerjs/engine-render","rxjs","react/jsx-runtime","@univerjs/design","react"],s):(o=typeof globalThis<"u"?globalThis:o||self,s(o.UniverDocsQuickInsertUi={},o.UniverCore,o.UniverDocsDrawing,o.UniverDrawing,o.UniverDrawingUi,o.UniverUi,o.UniverDocs,o.UniverDocsUi,o.UniverEngineRender,o.rxjs,o.React,o.UniverDesign,o.React))})(this,function(o,s,M,de,ue,p,E,O,ae,y,h,w,m){"use strict";var Ue=Object.defineProperty;var Ee=(o,s,M)=>s in o?Ue(o,s,{enumerable:!0,configurable:!0,writable:!0,value:M}):o[s]=M;var P=(o,s,M)=>Ee(o,typeof s!="symbol"?s+"":s,M);const V={id:"doc.command.delete-search-key",type:s.CommandType.COMMAND,handler:(i,n)=>{const e=i.get(s.ICommandService),{start:t,end:r}=n;return e.syncExecuteCommand(O.CutContentCommand.id,{segmentId:"",textRanges:[{startOffset:t,endOffset:t,collapsed:!0}],selections:[{startOffset:t,endOffset:r,collapsed:!1,direction:s.RANGE_DIRECTION.FORWARD}]})}},F="docs.quick.insert.keyword-input-placeholder",N=()=>{const i=p.useDependency(s.LocaleService);return h.jsx("div",{className:"univer-translate-y-1.5 univer-text-sm univer-text-gray-500",children:i.t("docQuickInsert.keywordInputPlaceholder")})};N.componentKey=F;const G="docs.quick.insert.placeholder",T=()=>{const i=p.useDependency(s.LocaleService);return h.jsx("div",{className:`
|
|
2
2
|
univer-flex univer-h-full univer-items-center univer-justify-center univer-rounded-lg univer-bg-white
|
|
3
3
|
univer-px-12 univer-py-6 univer-text-gray-400
|
|
4
|
-
`,children:
|
|
4
|
+
`,children:h.jsx("span",{children:i.t("docQuickInsert.placeholder")})})};T.componentKey=G;function K(i,n){return i.map(e=>({...e})).filter(e=>{if("children"in e)return e.children=K(e.children,n),e.children.length>0;const t=e.keywords;return t?t.some(r=>r.includes(n)):e.title.toLowerCase().includes(n)})}function Z(i,n){return i.map(e=>{const t={...e};return"children"in t&&(t.children=Z(t.children,n)),t.title=n.t(t.title),"keywords"in t&&(t.keywords=t.keywords.concat(t.title).map(r=>r.toLowerCase())),t})}const le=[p.KeyCode.ARROW_UP,p.KeyCode.ARROW_DOWN,p.KeyCode.ENTER],$=()=>{const i=p.useDependency(s.LocaleService),n=p.useDependency(o.DocQuickInsertPopupService),e=p.useDependency(p.ComponentManager),t=p.useDependency(p.IShortcutService),r=p.useDependency(s.ICommandService),c=m.useMemo(()=>s.generateRandomId(),[]),[a,v]=m.useState(0),g=m.useRef(null),d=m.useRef(0);d.current=0;const u=p.useObservable(n.filterKeyword$,""),l=p.useObservable(n.editPopup$),I=p.useObservable(l==null?void 0:l.popup.menus$,[]),b=m.useMemo(()=>Z(I,i),[I]),[W,Qe]=m.useState(()=>K(b,u.toLowerCase()));m.useEffect(()=>{const C=requestIdleCallback(()=>{Qe(K(b,u.toLowerCase()))});return()=>{cancelIdleCallback(C)}},[b,u]);const se=C=>{n.emitMenuSelected(C),r.executeCommand(Q.id)};m.useEffect(()=>{const C=new s.DisposableCollection;t.getAllShortcuts().filter(f=>f.binding&&le.includes(f.binding)).forEach(f=>{const k=f.preconditions;f.preconditions=()=>!1,C.add(s.toDisposable(()=>{f.preconditions=k}))});const D={id:`quick.insert.popup.enter.${c}`,type:s.CommandType.OPERATION,handler:()=>{const f=g.current;f&&se(f)}},U={id:`quick.insert.popup.move.cursor.up.${c}`,type:s.CommandType.OPERATION,handler:()=>{v(f=>{const k=f-1;return k>=0?k:d.current-1})}},R={id:`quick.insert.popup.move.cursor.down.${c}`,type:s.CommandType.OPERATION,handler:()=>{v(f=>{const k=f+1;return k<=d.current-1?k:0})}};return C.add(r.registerCommand(U)),C.add(r.registerCommand(R)),C.add(r.registerCommand(D)),C.add(t.registerShortcut({priority:1e3,id:U.id,binding:p.KeyCode.ARROW_UP,preconditions:()=>!0,staticParameters:{direction:s.Direction.UP}})),C.add(t.registerShortcut({priority:1e3,id:R.id,binding:p.KeyCode.ARROW_DOWN,preconditions:()=>!0,staticParameters:{direction:s.Direction.DOWN}})),C.add(t.registerShortcut({priority:1e3,id:D.id,binding:p.KeyCode.ENTER,preconditions:()=>!0})),()=>{C.dispose()}},[]),m.useEffect(()=>{v(0)},[W]);const B=m.useRef(new Map);m.useEffect(()=>()=>{B.current.clear()},[]);function oe(C){return C.map(_=>{const z=_.icon,D=z?e.get(z):null;if("children"in _)return h.jsx(w.MenuItemGroup,{title:h.jsxs("div",{className:`
|
|
5
5
|
univer-mb-2 univer-flex univer-items-center univer-text-xs univer-text-gray-400
|
|
6
|
-
`,children:[
|
|
7
|
-
univer-rounded-lg univer-border univer-border-solid univer-border-gray-100
|
|
6
|
+
`,children:[D&&h.jsx("span",{className:"univer-mr-2 univer-inline-flex univer-text-base",children:h.jsx(D,{})}),h.jsx("span",{children:_.title})]}),children:oe(_.children)},_.id);const U=d.current,R=a===U;if(R){g.current=_;const f=B.current.get(_.id);f==null||f.scrollIntoView({block:"nearest"})}return d.current++,h.jsx(w.MenuItem,{ref:f=>{f&&B.current.set(_.id,f)},onMouseEnter:()=>v(U),onMouseLeave:()=>v(Number.NaN),className:w.clsx("univer-w-[calc(220px-var(--padding-base)*2)] univer-text-sm",{"hover:univer-bg-transparent":!R,"univer-bg-gray-100":R}),onClick:()=>{se(_)},children:h.jsxs("div",{className:"univer-flex univer-w-full univer-items-center univer-px-1",children:[D&&h.jsx("span",{className:"univer-mr-2 univer-inline-flex univer-text-base",children:h.jsx(D,{})}),h.jsx(w.Tooltip,{showIfEllipsis:!0,title:_.title,placement:"right",children:h.jsx("span",{className:"univer-truncate",children:_.title})})]})},_.id)})}const je=W.length>0,ce=(l==null?void 0:l.popup.Placeholder)||e.get(T.componentKey);return h.jsx("div",{className:w.clsx(`
|
|
7
|
+
univer-rounded-lg univer-border univer-border-solid univer-border-gray-100 univer-bg-white
|
|
8
8
|
univer-shadow-[0_0_10px_0_rgba(0,0,0,0.1)]
|
|
9
|
-
`),children:Qe?f.jsx("div",{className:"univer-max-h-[360px] univer-w-[220px] univer-overflow-y-auto",children:f.jsx(w.Menu,{children:re(L)})}):se&&f.jsx(se,{})})};R.componentKey="docs.quick.insert.popup";var ue=Object.getOwnPropertyDescriptor,ae=(i,n,e,t)=>{for(var r=t>1?void 0:t?ue(n,e):n,c=i.length-1,d;c>=0;c--)(d=i[c])&&(r=d(r)||r);return r},T=(i,n)=>(e,t)=>n(e,t,i);o.DocQuickInsertPopupService=class extends s.Disposable{constructor(e,t,r){super();_(this,"_popups",new Set);_(this,"_editPopup$",new y.BehaviorSubject(void 0));_(this,"editPopup$",this._editPopup$.asObservable());_(this,"_inputOffset$",new y.BehaviorSubject({start:0,end:0}));_(this,"inputOffset$",this._inputOffset$.asObservable());_(this,"filterKeyword$");_(this,"_menuSelectedCallbacks",new Set);_(this,"_inputPlaceholderRenderRoot",null);this._docCanvasPopupManagerService=e,this._univerInstanceService=t,this._commandService=r,this.disposeWithMe(this._editPopup$);const c=(d,a)=>{var u,p;return(p=(u=this._univerInstanceService.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_DOC))==null?void 0:u.getBody())==null?void 0:p.dataStream.slice(d,a)};this.filterKeyword$=this._inputOffset$.pipe(y.map(d=>{var u;const a=c(d.start,d.end);return(u=a==null?void 0:a.slice(1))!=null?u:""}),y.distinctUntilChanged()),this.disposeWithMe(y.combineLatest([this.filterKeyword$.pipe(y.tap(d=>{var a,u,p;d.length>0?(u=(a=this._inputPlaceholderRenderRoot)==null?void 0:a.unmount)==null||u.dispose():(p=this._inputPlaceholderRenderRoot)==null||p.mount()})),this.editPopup$.pipe(y.tap(d=>{var a,u;d||(u=(a=this._inputPlaceholderRenderRoot)==null?void 0:a.unmount)==null||u.dispose()}))]).subscribe())}get editPopup(){return this._editPopup$.value}get inputOffset(){return this._inputOffset$.value}setInputOffset(e){this._inputOffset$.next(e)}resolvePopup(e){return Array.from(this._popups).find(t=>t.keyword===e)}registerPopup(e){return this._popups.add(e),()=>{this._popups.delete(e)}}_createInputPlaceholderRenderRoot(e){return{mount(){this.unmount=e()}}}showPopup(e){const{popup:t,index:r,unitId:c}=e;this.closePopup();const d=this._docCanvasPopupManagerService.attachPopupToRange({startOffset:r,endOffset:r,collapsed:!0},{componentKey:R.componentKey,onClickOutside:()=>{this.closePopup()},direction:"bottom"},c);this._inputPlaceholderRenderRoot=this._createInputPlaceholderRenderRoot(()=>{const a=this._docCanvasPopupManagerService.attachPopupToRange({startOffset:r+1,endOffset:r+1,collapsed:!1},{componentKey:x.componentKey,onClickOutside:()=>{a.dispose()},direction:"horizontal"},c);return a}),this._inputPlaceholderRenderRoot.mount(),this._editPopup$.next({disposable:d,popup:t,anchor:r,unitId:c})}closePopup(){this.editPopup&&(this.editPopup.disposable.dispose(),this._editPopup$.next(null))}onMenuSelected(e){return this._menuSelectedCallbacks.add(e),()=>{this._menuSelectedCallbacks.delete(e)}}emitMenuSelected(e){const{start:t,end:r}=this.inputOffset;this._commandService.syncExecuteCommand(z.id,{start:t,end:r}),setTimeout(()=>{this._menuSelectedCallbacks.forEach(c=>c(e))},0)}},o.DocQuickInsertPopupService=ae([T(0,s.Inject(C.DocCanvasPopManagerService)),T(1,s.Inject(s.IUniverInstanceService)),T(2,s.Inject(s.ICommandService))],o.DocQuickInsertPopupService);const G={type:s.CommandType.OPERATION,id:"doc.operation.show-quick-insert-popup",handler(i,n){const e=i.get(o.DocQuickInsertPopupService);return n?(e.showPopup(n),!0):!1}},M={type:s.CommandType.OPERATION,id:"doc.operation.close-quick-insert-popup",handler(i){return i.get(o.DocQuickInsertPopupService).closePopup(),!0}},Z={id:"quick-insert.text.menu",title:"docQuickInsert.menu.text",icon:"TextSingle",keywords:["text"]},J={id:C.OrderListCommand.id,title:"docQuickInsert.menu.numberedList",icon:"OrderSingle",keywords:["numbered","list","ordered"]},X={id:C.BulletListCommand.id,title:"docQuickInsert.menu.bulletedList",icon:"UnorderSingle",keywords:["bulleted","list","unordered"]},Y={id:C.HorizontalLineCommand.id,title:"docQuickInsert.menu.divider",icon:"DividerSingle",keywords:["divider","line","separate"]},le=[{title:"docQuickInsert.group.basics",id:"quick.insert.group.basic",children:[Z,J,X,Y]}],pe=new Set([J.id,X.id,Y.id]);var fe=Object.getOwnPropertyDescriptor,ve=(i,n,e,t)=>{for(var r=t>1?void 0:t?fe(n,e):n,c=i.length-1,d;c>=0;c--)(d=i[c])&&(r=d(r)||r);return r},U=(i,n)=>(e,t)=>n(e,t,i);o.DocQuickInsertTriggerController=class extends s.Disposable{constructor(n,e,t,r){super(),this._commandService=n,this._textSelectionManagerService=e,this._docQuickInsertPopupService=t,this._shortcutService=r,this.disposeWithMe(this._shortcutService.registerShortcut({id:M.id,binding:l.KeyCode.ESC,preconditions:()=>!!this._docQuickInsertPopupService.editPopup,priority:1e3})),this._initTrigger(),this._initMenuHandler()}_initTrigger(){this.disposeWithMe(this._commandService.onCommandExecuted(n=>{var c,d,a;const{_docQuickInsertPopupService:e,_textSelectionManagerService:t,_commandService:r}=this;if(n.id===C.InsertCommand.id){const u=n.params;if(e.editPopup){e.setInputOffset({start:e.inputOffset.start,end:u.range.endOffset+1});return}const p=t.getActiveTextRange();if(!p)return;const S=e.resolvePopup(u.body.dataStream);if(!S||!(S.preconditions?S.preconditions(u):!0))return;e.setInputOffset({start:p.startOffset-1,end:p.startOffset}),setTimeout(()=>{r.executeCommand(G.id,{index:p.startOffset-1,unitId:u.unitId,popup:S})},100)}if(n.id===W.RichTextEditingMutation.id){const u=n.params;if(u.isCompositionEnd){const p=(d=(c=u.textRanges)==null?void 0:c[0])==null?void 0:d.endOffset;p&&e.setInputOffset({start:e.inputOffset.start,end:p})}}if(n.id===C.DeleteCommand.id){const u=n.params;if(e.editPopup&&u.direction===s.DeleteDirection.LEFT){const p=(a=u.len)!=null?a:0;e.setInputOffset({start:e.inputOffset.start,end:u.range.endOffset-p})}}if(n.id===C.MoveCursorOperation.id){const u=n.params;(u.direction===s.Direction.LEFT||u.direction===s.Direction.RIGHT)&&e.editPopup&&r.executeCommand(M.id)}if(n.id===C.DeleteLeftCommand.id){const u=t.getActiveTextRange();if(!e.editPopup||!u)return;u.endOffset<=e.editPopup.anchor&&r.executeCommand(M.id)}}))}_initMenuHandler(){this.disposeWithMe(this._docQuickInsertPopupService.onMenuSelected(n=>{n.id!==Z.id&&pe.has(n.id)&&this._commandService.executeCommand(n.id)}))}},o.DocQuickInsertTriggerController=ve([U(0,s.ICommandService),U(1,s.Inject(W.DocSelectionManagerService)),U(2,s.Inject(o.DocQuickInsertPopupService)),U(3,s.Inject(l.IShortcutService))],o.DocQuickInsertTriggerController);var g=function(){return g=Object.assign||function(i){for(var n,e=1,t=arguments.length;e<t;e++){n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(i[r]=n[r])}return i},g.apply(this,arguments)},he=function(i,n){var e={};for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&n.indexOf(t)<0&&(e[t]=i[t]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,t=Object.getOwnPropertySymbols(i);r<t.length;r++)n.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(i,t[r])&&(e[t[r]]=i[t[r]]);return e},E=v.forwardRef(function(i,n){var e=i.icon,t=i.id,r=i.className,c=i.extend,d=he(i,["icon","id","className","extend"]),a="univerjs-icon univerjs-icon-".concat(t," ").concat(r||"").trim(),u=v.useRef("_".concat(Ie()));return ee(e,"".concat(t),{defIds:e.defIds,idSuffix:u.current},g({ref:n,className:a},d),c)});function ee(i,n,e,t,r){return v.createElement(i.tag,g(g({key:n},me(i,e,r)),t),(ge(i,e).children||[]).map(function(c,d){return ee(c,"".concat(n,"-").concat(i.tag,"-").concat(d),e,void 0,r)}))}function me(i,n,e){var t=g({},i.attrs);e!=null&&e.colorChannel1&&t.fill==="colorChannel1"&&(t.fill=e.colorChannel1),i.tag==="mask"&&t.id&&(t.id=t.id+n.idSuffix),Object.entries(t).forEach(function(c){var d=c[0],a=c[1];d==="mask"&&typeof a=="string"&&(t[d]=a.replace(/url\(#(.*)\)/,"url(#$1".concat(n.idSuffix,")")))});var r=n.defIds;return!r||r.length===0||(i.tag==="use"&&t["xlink:href"]&&(t["xlink:href"]=t["xlink:href"]+n.idSuffix),Object.entries(t).forEach(function(c){var d=c[0],a=c[1];typeof a=="string"&&(t[d]=a.replace(/url\(#(.*)\)/,"url(#$1".concat(n.idSuffix,")")))})),t}function ge(i,n){var e,t=n.defIds;return!t||t.length===0?i:i.tag==="defs"&&(!((e=i.children)===null||e===void 0)&&e.length)?g(g({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&t&&t.indexOf(r.attrs.id)>-1?g(g({},r),{attrs:g(g({},r.attrs),{id:r.attrs.id+n.idSuffix})}):r})}):i}function Ie(){return Math.random().toString(36).substring(2,8)}E.displayName="UniverIcon";var Ce={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M1.01953 3.13985C1.01953 2.77258 1.31726 2.47485 1.68453 2.47485H2.73713C3.1044 2.47485 3.40213 2.77258 3.40213 3.13985 3.40213 3.50712 3.1044 3.80485 2.73713 3.80485H1.68453C1.31726 3.80485 1.01953 3.50712 1.01953 3.13985zM4.17734 3.13985C4.17734 2.77258 4.47507 2.47485 4.84234 2.47485H6.94754C7.31481 2.47485 7.61254 2.77258 7.61254 3.13985 7.61254 3.50712 7.31481 3.80485 6.94754 3.80485H4.84234C4.47507 3.80485 4.17734 3.50712 4.17734 3.13985zM8.38775 3.13985C8.38775 2.77258 8.68548 2.47485 9.05275 2.47485H11.158C11.5252 2.47485 11.823 2.77258 11.823 3.13985 11.823 3.50712 11.5252 3.80485 11.158 3.80485H9.05275C8.68548 3.80485 8.38775 3.50712 8.38775 3.13985zM12.5982 3.13985C12.5982 2.77258 12.8959 2.47485 13.2632 2.47485H14.3158C14.683 2.47485 14.9808 2.77258 14.9808 3.13985 14.9808 3.50712 14.683 3.80485 14.3158 3.80485H13.2632C12.8959 3.80485 12.5982 3.50712 12.5982 3.13985zM1.01953 7.99972C1.01953 7.63245 1.31726 7.33472 1.68453 7.33472H14.3158C14.683 7.33472 14.9808 7.63245 14.9808 7.99972 14.9808 8.36699 14.683 8.66472 14.3158 8.66472H1.68453C1.31726 8.66472 1.01953 8.36699 1.01953 7.99972zM1.68453 12.1951C1.31726 12.1951 1.01953 12.4928 1.01953 12.8601 1.01953 13.2273 1.31726 13.5251 1.68453 13.5251H2.73713C3.1044 13.5251 3.40213 13.2273 3.40213 12.8601 3.40213 12.4928 3.1044 12.1951 2.73713 12.1951H1.68453zM4.84234 12.1951C4.47507 12.1951 4.17734 12.4928 4.17734 12.8601 4.17734 13.2273 4.47507 13.5251 4.84234 13.5251H6.94754C7.31481 13.5251 7.61254 13.2273 7.61254 12.8601 7.61254 12.4928 7.31481 12.1951 6.94754 12.1951H4.84234zM9.05275 12.1951C8.68548 12.1951 8.38775 12.4928 8.38775 12.8601 8.38775 13.2273 8.68548 13.5251 9.05275 13.5251H11.158C11.5252 13.5251 11.823 13.2273 11.823 12.8601 11.823 12.4928 11.5252 12.1951 11.158 12.1951H9.05275zM13.2632 12.1951C12.8959 12.1951 12.5982 12.4928 12.5982 12.8601 12.5982 13.2273 12.8959 13.5251 13.2632 13.5251H14.3158C14.683 13.5251 14.9808 13.2273 14.9808 12.8601 14.9808 12.4928 14.683 12.1951 14.3158 12.1951H13.2632z"}}]},$=v.forwardRef(function(i,n){return v.createElement(E,Object.assign({},i,{id:"divider-single",ref:n,icon:Ce}))});$.displayName="DividerSingle";var _e={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.66695 1.33496C2.29968 1.33496 2.00195 1.63269 2.00195 1.99996V3.64439C2.00195 4.01166 2.29968 4.30939 2.66695 4.30939C3.03422 4.30939 3.33195 4.01166 3.33195 3.64439V2.66496H7.33521V13.335H5.3337C4.96643 13.335 4.6687 13.6327 4.6687 14C4.6687 14.3672 4.96643 14.665 5.3337 14.665H10.667C11.0343 14.665 11.332 14.3672 11.332 14C11.332 13.6327 11.0343 13.335 10.667 13.335H8.66521V2.66496H12.6686V3.64439C12.6686 4.01166 12.9664 4.30939 13.3336 4.30939C13.7009 4.30939 13.9986 4.01166 13.9986 3.64439V1.99996C13.9986 1.63269 13.7009 1.33496 13.3336 1.33496H2.66695Z"}}]},K=v.forwardRef(function(i,n){return v.createElement(E,Object.assign({},i,{id:"text-single",ref:n,icon:_e}))});K.displayName="TextSingle";var ye=Object.getOwnPropertyDescriptor,Se=(i,n,e,t)=>{for(var r=t>1?void 0:t?ye(n,e):n,c=i.length-1,d;c>=0;c--)(d=i[c])&&(r=d(r)||r);return r},H=(i,n)=>(e,t)=>n(e,t,i);o.DocQuickInsertUIController=class extends s.Disposable{constructor(n,e,t){super(),this._commandService=n,this._docQuickInsertPopupService=e,this._componentManager=t,this._initCommands(),this._initComponents(),this._initMenus()}_initCommands(){[z,G,M].forEach(n=>{this.disposeWithMe(this._commandService.registerCommand(n))})}_initComponents(){[[R.componentKey,R],[x.componentKey,x],[j.componentKey,j],[$.displayName,$],[K.displayName,K]].forEach(([e,t])=>{e&&this.disposeWithMe(this._componentManager.register(e,t))}),[{keyword:"/",menus$:y.of(le),preconditions:e=>{var t;return((t=e.range.startNodePosition)==null?void 0:t.glyph)===0}}].forEach(e=>{this.disposeWithMe(this._docQuickInsertPopupService.registerPopup(e))})}_initMenus(){}},o.DocQuickInsertUIController=Se([H(0,s.ICommandService),H(1,s.Inject(o.DocQuickInsertPopupService)),H(2,s.Inject(l.ComponentManager))],o.DocQuickInsertUIController);var Pe=Object.defineProperty,Oe=Object.getOwnPropertyDescriptor,De=(i,n,e)=>n in i?Pe(i,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[n]=e,ke=(i,n,e,t)=>{for(var r=t>1?void 0:t?Oe(n,e):n,c=i.length-1,d;c>=0;c--)(d=i[c])&&(r=d(r)||r);return r},be=(i,n)=>(e,t)=>n(e,t,i),te=(i,n,e)=>De(i,typeof n!="symbol"?n+"":n,e);const we="DOC_QUICK_INSERT_UI_PLUGIN";o.UniverDocsQuickInsertUIPlugin=class extends s.Plugin{constructor(n){super(),this._injector=n}onStarting(){[[o.DocQuickInsertUIController],[o.DocQuickInsertTriggerController],[o.DocQuickInsertPopupService]].forEach(e=>this._injector.add(e)),this._injector.get(o.DocQuickInsertUIController)}onRendered(){this._injector.get(o.DocQuickInsertTriggerController),this._injector.get(o.DocQuickInsertPopupService)}},te(o.UniverDocsQuickInsertUIPlugin,"type",s.UniverInstanceType.UNIVER_DOC),te(o.UniverDocsQuickInsertUIPlugin,"pluginName",we),o.UniverDocsQuickInsertUIPlugin=ke([s.DependentOn(ce.UniverDrawingUIPlugin,oe.UniverDrawingPlugin,k.UniverDocsDrawingPlugin,l.UniverUIPlugin),be(0,s.Inject(s.Injector))],o.UniverDocsQuickInsertUIPlugin),o.KeywordInputPlaceholderComponentKey=B,o.QuickInsertPlaceholderComponentKey=V,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
|
9
|
+
`),children:je?h.jsx("div",{className:`
|
|
10
|
+
univer-max-h-[360px] univer-w-[220px] univer-overflow-y-auto univer-overflow-x-hidden
|
|
11
|
+
`,children:h.jsx(w.Menu,{children:oe(W)})}):ce&&h.jsx(ce,{})})};$.componentKey="docs.quick.insert.popup";var pe=Object.getOwnPropertyDescriptor,ve=(i,n,e,t)=>{for(var r=t>1?void 0:t?pe(n,e):n,c=i.length-1,a;c>=0;c--)(a=i[c])&&(r=a(r)||r);return r},x=(i,n)=>(e,t)=>n(e,t,i);const J={dispose:()=>{}};o.DocQuickInsertPopupService=class extends s.Disposable{constructor(e,t,r,c,a){super();P(this,"_popups",new Set);P(this,"_editPopup$",new y.BehaviorSubject(void 0));P(this,"editPopup$",this._editPopup$.asObservable());P(this,"_isComposing$",new y.BehaviorSubject(!1));P(this,"isComposing$",this._isComposing$.asObservable());P(this,"_inputOffset$",new y.BehaviorSubject({start:0,end:0}));P(this,"inputOffset$",this._inputOffset$.asObservable());P(this,"filterKeyword$");P(this,"_menuSelectedCallbacks",new Set);P(this,"_inputPlaceholderRenderRoot",null);this._docCanvasPopupManagerService=e,this._univerInstanceService=t,this._commandService=r,this._renderManagerService=c,this._docSelectionManagerService=a,this.disposeWithMe(this._editPopup$);const v=(d,u)=>{var l,I;return(I=(l=this._univerInstanceService.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_DOC))==null?void 0:l.getBody())==null?void 0:I.dataStream.slice(d,u)};let g="";this.filterKeyword$=this._inputOffset$.pipe(y.map(d=>{var l;const u=v(d.start,d.end);return(l=u==null?void 0:u.slice(1))!=null?l:""}),y.distinctUntilChanged(),y.tap(d=>{g=d})),this.disposeWithMe(y.combineLatest([this.filterKeyword$.pipe(y.tap(d=>{var u,l,I;d.length>0?(l=(u=this._inputPlaceholderRenderRoot)==null?void 0:u.unmount)==null||l.dispose():(I=this._inputPlaceholderRenderRoot)==null||I.mount()})),this.isComposing$.pipe(y.tap(d=>{var u,l,I;d?(l=(u=this._inputPlaceholderRenderRoot)==null?void 0:u.unmount)==null||l.dispose():g.length<=0&&((I=this._inputPlaceholderRenderRoot)==null||I.mount())})),this.editPopup$.pipe(y.tap(d=>{var u,l;d||((l=(u=this._inputPlaceholderRenderRoot)==null?void 0:u.unmount)==null||l.dispose(),this._inputPlaceholderRenderRoot=null)}))]).subscribe())}get editPopup(){return this._editPopup$.value}get isComposing(){return this._isComposing$.value}setIsComposing(e){this._isComposing$.next(e)}get inputOffset(){return this._inputOffset$.value}setInputOffset(e){this._inputOffset$.next(e)}resolvePopup(e){return Array.from(this._popups).find(t=>t.keyword===e)}registerPopup(e){return this._popups.add(e),()=>{this._popups.delete(e)}}_createInputPlaceholderRenderRoot(e){return{isMounted:!1,mount(){if(this.isMounted)return;this.isMounted=!0;const r=e();this.unmount={dispose:()=>{r.dispose(),this.isMounted=!1}}}}}showPopup(e){const{popup:t,index:r,unitId:c}=e;this.closePopup(),this._inputPlaceholderRenderRoot=this._createInputPlaceholderRenderRoot(()=>{var b;const v=(b=this._renderManagerService.getRenderById(c))==null?void 0:b.with(E.DocSkeletonManagerService),g=this._docSelectionManagerService.getActiveTextRange();if(!v||!g)return J;const u=v.getSkeleton().findNodeByCharIndex(g.startOffset,g.segmentId,g.segmentPage);if(!((u==null?void 0:u.content)==="\r"))return J;const I=this._docCanvasPopupManagerService.attachPopupToRange({startOffset:r+1,endOffset:r+1,collapsed:!1},{componentKey:N.componentKey,onClickOutside:()=>{I.dispose()},direction:"horizontal"},c);return I}),this._inputPlaceholderRenderRoot.mount();const a=this._docCanvasPopupManagerService.attachPopupToRange({startOffset:r,endOffset:r,collapsed:!0},{componentKey:$.componentKey,onClickOutside:()=>{this.closePopup()},direction:"bottom"},c);this._editPopup$.next({disposable:a,popup:t,anchor:r,unitId:c})}closePopup(){this.editPopup&&(this.editPopup.disposable.dispose(),this._editPopup$.next(null))}onMenuSelected(e){return this._menuSelectedCallbacks.add(e),()=>{this._menuSelectedCallbacks.delete(e)}}emitMenuSelected(e){const{start:t,end:r}=this.inputOffset;this._commandService.syncExecuteCommand(V.id,{start:t,end:r}),setTimeout(()=>{this._menuSelectedCallbacks.forEach(c=>c(e))},0)}},o.DocQuickInsertPopupService=ve([x(0,s.Inject(O.DocCanvasPopManagerService)),x(1,s.Inject(s.IUniverInstanceService)),x(2,s.Inject(s.ICommandService)),x(3,s.Inject(ae.IRenderManagerService)),x(4,s.Inject(E.DocSelectionManagerService))],o.DocQuickInsertPopupService);const X={type:s.CommandType.OPERATION,id:"doc.operation.show-quick-insert-popup",handler(i,n){const e=i.get(o.DocQuickInsertPopupService);return n?(e.showPopup(n),!0):!1}},Q={type:s.CommandType.OPERATION,id:"doc.operation.close-quick-insert-popup",handler(i){return i.get(o.DocQuickInsertPopupService).closePopup(),!0}},Y={id:"quick-insert.text.menu",title:"docQuickInsert.menu.text",icon:"TextSingle",keywords:["text"]},ee={id:O.OrderListCommand.id,title:"docQuickInsert.menu.numberedList",icon:"OrderSingle",keywords:["numbered","list","ordered"]},te={id:O.BulletListCommand.id,title:"docQuickInsert.menu.bulletedList",icon:"UnorderSingle",keywords:["bulleted","list","unordered"]},ne={id:O.HorizontalLineCommand.id,title:"docQuickInsert.menu.divider",icon:"DividerSingle",keywords:["divider","line","separate"]},fe=[{title:"docQuickInsert.group.basics",id:"quick.insert.group.basic",children:[Y,ee,te,ne]}],he=new Set([ee.id,te.id,ne.id]);var me=Object.getOwnPropertyDescriptor,ge=(i,n,e,t)=>{for(var r=t>1?void 0:t?me(n,e):n,c=i.length-1,a;c>=0;c--)(a=i[c])&&(r=a(r)||r);return r},j=(i,n)=>(e,t)=>n(e,t,i);o.DocQuickInsertTriggerController=class extends s.Disposable{constructor(n,e,t,r,c){super(),this._commandService=n,this._textSelectionManagerService=e,this._docQuickInsertPopupService=t,this._shortcutService=r,this._univerInstanceService=c,this.disposeWithMe(this._shortcutService.registerShortcut({id:Q.id,binding:p.KeyCode.ESC,preconditions:()=>!!this._docQuickInsertPopupService.editPopup,priority:1e3})),this._initTrigger(),this._initMenuHandler()}_initTrigger(){this.disposeWithMe(this._commandService.onCommandExecuted(n=>{var a,v,g;const{_docQuickInsertPopupService:e,_textSelectionManagerService:t,_commandService:r}=this,c=this._univerInstanceService.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_DOC);if(!(c!=null&&c.getDisabled())){if(n.id===O.InsertCommand.id){const d=n.params;if(e.editPopup){e.setInputOffset({start:e.inputOffset.start,end:d.range.endOffset+1});return}const u=t.getActiveTextRange();if(!u)return;const l=e.resolvePopup(d.body.dataStream);if(!l||!(l.preconditions?l.preconditions(d):!0))return;e.setInputOffset({start:u.startOffset-1,end:u.startOffset}),setTimeout(()=>{r.executeCommand(X.id,{index:u.startOffset-1,unitId:d.unitId,popup:l})},100)}if(n.id===O.IMEInputCommand.id){const d=n.params;!e.isComposing&&d.isCompositionStart&&e.setIsComposing(!0),e.isComposing&&d.isCompositionEnd&&e.setIsComposing(!1)}if(n.id===E.RichTextEditingMutation.id){const d=n.params;if(d.isCompositionEnd){const u=(v=(a=d.textRanges)==null?void 0:a[0])==null?void 0:v.endOffset;u&&e.setInputOffset({start:e.inputOffset.start,end:u})}}if(n.id===O.DeleteCommand.id){const d=n.params;if(e.editPopup&&d.direction===s.DeleteDirection.LEFT){const u=(g=d.len)!=null?g:0;e.setInputOffset({start:e.inputOffset.start,end:d.range.endOffset-u})}}if(n.id===O.MoveCursorOperation.id){const d=n.params;(d.direction===s.Direction.LEFT||d.direction===s.Direction.RIGHT)&&e.editPopup&&r.executeCommand(Q.id)}if(n.id===O.DeleteLeftCommand.id){const d=t.getActiveTextRange();if(!e.editPopup||!d)return;d.endOffset<=e.editPopup.anchor&&r.executeCommand(Q.id)}}}))}_initMenuHandler(){this.disposeWithMe(this._docQuickInsertPopupService.onMenuSelected(n=>{n.id!==Y.id&&he.has(n.id)&&this._commandService.executeCommand(n.id)}))}},o.DocQuickInsertTriggerController=ge([j(0,s.ICommandService),j(1,s.Inject(E.DocSelectionManagerService)),j(2,s.Inject(o.DocQuickInsertPopupService)),j(3,s.Inject(p.IShortcutService)),j(4,s.Inject(s.IUniverInstanceService))],o.DocQuickInsertTriggerController);var S=function(){return S=Object.assign||function(i){for(var n,e=1,t=arguments.length;e<t;e++){n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(i[r]=n[r])}return i},S.apply(this,arguments)},Ie=function(i,n){var e={};for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&n.indexOf(t)<0&&(e[t]=i[t]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,t=Object.getOwnPropertySymbols(i);r<t.length;r++)n.indexOf(t[r])<0&&Object.prototype.propertyIsEnumerable.call(i,t[r])&&(e[t[r]]=i[t[r]]);return e},H=m.forwardRef(function(i,n){var e=i.icon,t=i.id,r=i.className,c=i.extend,a=Ie(i,["icon","id","className","extend"]),v="univerjs-icon univerjs-icon-".concat(t," ").concat(r||"").trim(),g=m.useRef("_".concat(Se()));return ie(e,"".concat(t),{defIds:e.defIds,idSuffix:g.current},S({ref:n,className:v},a),c)});function ie(i,n,e,t,r){return m.createElement(i.tag,S(S({key:n},Ce(i,e,r)),t),(_e(i,e).children||[]).map(function(c,a){return ie(c,"".concat(n,"-").concat(i.tag,"-").concat(a),e,void 0,r)}))}function Ce(i,n,e){var t=S({},i.attrs);e!=null&&e.colorChannel1&&t.fill==="colorChannel1"&&(t.fill=e.colorChannel1),i.tag==="mask"&&t.id&&(t.id=t.id+n.idSuffix),Object.entries(t).forEach(function(c){var a=c[0],v=c[1];a==="mask"&&typeof v=="string"&&(t[a]=v.replace(/url\(#(.*)\)/,"url(#$1".concat(n.idSuffix,")")))});var r=n.defIds;return!r||r.length===0||(i.tag==="use"&&t["xlink:href"]&&(t["xlink:href"]=t["xlink:href"]+n.idSuffix),Object.entries(t).forEach(function(c){var a=c[0],v=c[1];typeof v=="string"&&(t[a]=v.replace(/url\(#(.*)\)/,"url(#$1".concat(n.idSuffix,")")))})),t}function _e(i,n){var e,t=n.defIds;return!t||t.length===0?i:i.tag==="defs"&&(!((e=i.children)===null||e===void 0)&&e.length)?S(S({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&t&&t.indexOf(r.attrs.id)>-1?S(S({},r),{attrs:S(S({},r.attrs),{id:r.attrs.id+n.idSuffix})}):r})}):i}function Se(){return Math.random().toString(36).substring(2,8)}H.displayName="UniverIcon";var ye={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M1.01953 3.13985C1.01953 2.77258 1.31726 2.47485 1.68453 2.47485H2.73713C3.1044 2.47485 3.40213 2.77258 3.40213 3.13985 3.40213 3.50712 3.1044 3.80485 2.73713 3.80485H1.68453C1.31726 3.80485 1.01953 3.50712 1.01953 3.13985zM4.17734 3.13985C4.17734 2.77258 4.47507 2.47485 4.84234 2.47485H6.94754C7.31481 2.47485 7.61254 2.77258 7.61254 3.13985 7.61254 3.50712 7.31481 3.80485 6.94754 3.80485H4.84234C4.47507 3.80485 4.17734 3.50712 4.17734 3.13985zM8.38775 3.13985C8.38775 2.77258 8.68548 2.47485 9.05275 2.47485H11.158C11.5252 2.47485 11.823 2.77258 11.823 3.13985 11.823 3.50712 11.5252 3.80485 11.158 3.80485H9.05275C8.68548 3.80485 8.38775 3.50712 8.38775 3.13985zM12.5982 3.13985C12.5982 2.77258 12.8959 2.47485 13.2632 2.47485H14.3158C14.683 2.47485 14.9808 2.77258 14.9808 3.13985 14.9808 3.50712 14.683 3.80485 14.3158 3.80485H13.2632C12.8959 3.80485 12.5982 3.50712 12.5982 3.13985zM1.01953 7.99972C1.01953 7.63245 1.31726 7.33472 1.68453 7.33472H14.3158C14.683 7.33472 14.9808 7.63245 14.9808 7.99972 14.9808 8.36699 14.683 8.66472 14.3158 8.66472H1.68453C1.31726 8.66472 1.01953 8.36699 1.01953 7.99972zM1.68453 12.1951C1.31726 12.1951 1.01953 12.4928 1.01953 12.8601 1.01953 13.2273 1.31726 13.5251 1.68453 13.5251H2.73713C3.1044 13.5251 3.40213 13.2273 3.40213 12.8601 3.40213 12.4928 3.1044 12.1951 2.73713 12.1951H1.68453zM4.84234 12.1951C4.47507 12.1951 4.17734 12.4928 4.17734 12.8601 4.17734 13.2273 4.47507 13.5251 4.84234 13.5251H6.94754C7.31481 13.5251 7.61254 13.2273 7.61254 12.8601 7.61254 12.4928 7.31481 12.1951 6.94754 12.1951H4.84234zM9.05275 12.1951C8.68548 12.1951 8.38775 12.4928 8.38775 12.8601 8.38775 13.2273 8.68548 13.5251 9.05275 13.5251H11.158C11.5252 13.5251 11.823 13.2273 11.823 12.8601 11.823 12.4928 11.5252 12.1951 11.158 12.1951H9.05275zM13.2632 12.1951C12.8959 12.1951 12.5982 12.4928 12.5982 12.8601 12.5982 13.2273 12.8959 13.5251 13.2632 13.5251H14.3158C14.683 13.5251 14.9808 13.2273 14.9808 12.8601 14.9808 12.4928 14.683 12.1951 14.3158 12.1951H13.2632z"}}]},q=m.forwardRef(function(i,n){return m.createElement(H,Object.assign({},i,{id:"divider-single",ref:n,icon:ye}))});q.displayName="DividerSingle";var Pe={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M2.66695 1.33496C2.29968 1.33496 2.00195 1.63269 2.00195 1.99996V3.64439C2.00195 4.01166 2.29968 4.30939 2.66695 4.30939C3.03422 4.30939 3.33195 4.01166 3.33195 3.64439V2.66496H7.33521V13.335H5.3337C4.96643 13.335 4.6687 13.6327 4.6687 14C4.6687 14.3672 4.96643 14.665 5.3337 14.665H10.667C11.0343 14.665 11.332 14.3672 11.332 14C11.332 13.6327 11.0343 13.335 10.667 13.335H8.66521V2.66496H12.6686V3.64439C12.6686 4.01166 12.9664 4.30939 13.3336 4.30939C13.7009 4.30939 13.9986 4.01166 13.9986 3.64439V1.99996C13.9986 1.63269 13.7009 1.33496 13.3336 1.33496H2.66695Z"}}]},L=m.forwardRef(function(i,n){return m.createElement(H,Object.assign({},i,{id:"text-single",ref:n,icon:Pe}))});L.displayName="TextSingle";var Oe=Object.getOwnPropertyDescriptor,De=(i,n,e,t)=>{for(var r=t>1?void 0:t?Oe(n,e):n,c=i.length-1,a;c>=0;c--)(a=i[c])&&(r=a(r)||r);return r},A=(i,n)=>(e,t)=>n(e,t,i);o.DocQuickInsertUIController=class extends s.Disposable{constructor(n,e,t){super(),this._commandService=n,this._docQuickInsertPopupService=e,this._componentManager=t,this._initCommands(),this._initComponents(),this._initMenus()}_initCommands(){[V,X,Q].forEach(n=>{this.disposeWithMe(this._commandService.registerCommand(n))})}_initComponents(){[[$.componentKey,$],[N.componentKey,N],[T.componentKey,T],[q.displayName,q],[L.displayName,L]].forEach(([e,t])=>{e&&this.disposeWithMe(this._componentManager.register(e,t))}),[{keyword:"/",menus$:y.of(fe),preconditions:e=>{var t;return((t=e.range.startNodePosition)==null?void 0:t.glyph)===0}}].forEach(e=>{this.disposeWithMe(this._docQuickInsertPopupService.registerPopup(e))})}_initMenus(){}},o.DocQuickInsertUIController=De([A(0,s.ICommandService),A(1,s.Inject(o.DocQuickInsertPopupService)),A(2,s.Inject(p.ComponentManager))],o.DocQuickInsertUIController);var ke=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,we=(i,n,e)=>n in i?ke(i,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[n]=e,be=(i,n,e,t)=>{for(var r=t>1?void 0:t?Me(n,e):n,c=i.length-1,a;c>=0;c--)(a=i[c])&&(r=a(r)||r);return r},Re=(i,n)=>(e,t)=>n(e,t,i),re=(i,n,e)=>we(i,typeof n!="symbol"?n+"":n,e);const xe="DOC_QUICK_INSERT_UI_PLUGIN";o.UniverDocsQuickInsertUIPlugin=class extends s.Plugin{constructor(n){super(),this._injector=n}onStarting(){[[o.DocQuickInsertUIController],[o.DocQuickInsertTriggerController],[o.DocQuickInsertPopupService]].forEach(e=>this._injector.add(e)),this._injector.get(o.DocQuickInsertUIController)}onRendered(){this._injector.get(o.DocQuickInsertTriggerController),this._injector.get(o.DocQuickInsertPopupService)}},re(o.UniverDocsQuickInsertUIPlugin,"type",s.UniverInstanceType.UNIVER_DOC),re(o.UniverDocsQuickInsertUIPlugin,"pluginName",xe),o.UniverDocsQuickInsertUIPlugin=be([s.DependentOn(ue.UniverDrawingUIPlugin,de.UniverDrawingPlugin,M.UniverDocsDrawingPlugin,p.UniverUIPlugin),Re(0,s.Inject(s.Injector))],o.UniverDocsQuickInsertUIPlugin),o.KeywordInputPlaceholderComponentKey=F,o.QuickInsertPlaceholderComponentKey=G,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/docs-quick-insert-ui",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.9-nightly.202504021607",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -48,19 +48,20 @@
|
|
|
48
48
|
"lib"
|
|
49
49
|
],
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"react": "
|
|
51
|
+
"react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
|
|
52
52
|
"rxjs": ">=7.0.0"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@univerjs/icons": "^0.2.
|
|
56
|
-
"@univerjs/core": "0.6.
|
|
57
|
-
"@univerjs/design": "0.6.
|
|
58
|
-
"@univerjs/docs": "0.6.
|
|
59
|
-
"@univerjs/docs-drawing": "0.6.
|
|
60
|
-
"@univerjs/
|
|
61
|
-
"@univerjs/drawing": "0.6.
|
|
62
|
-
"@univerjs/
|
|
63
|
-
"@univerjs/
|
|
55
|
+
"@univerjs/icons": "^0.2.31",
|
|
56
|
+
"@univerjs/core": "0.6.9-nightly.202504021607",
|
|
57
|
+
"@univerjs/design": "0.6.9-nightly.202504021607",
|
|
58
|
+
"@univerjs/docs": "0.6.9-nightly.202504021607",
|
|
59
|
+
"@univerjs/docs-drawing": "0.6.9-nightly.202504021607",
|
|
60
|
+
"@univerjs/drawing": "0.6.9-nightly.202504021607",
|
|
61
|
+
"@univerjs/drawing-ui": "0.6.9-nightly.202504021607",
|
|
62
|
+
"@univerjs/docs-ui": "0.6.9-nightly.202504021607",
|
|
63
|
+
"@univerjs/engine-render": "0.6.9-nightly.202504021607",
|
|
64
|
+
"@univerjs/ui": "0.6.9-nightly.202504021607"
|
|
64
65
|
},
|
|
65
66
|
"devDependencies": {
|
|
66
67
|
"postcss": "^8.5.3",
|
|
@@ -70,8 +71,7 @@
|
|
|
70
71
|
"typescript": "^5.8.2",
|
|
71
72
|
"vite": "^6.2.3",
|
|
72
73
|
"vitest": "^3.0.9",
|
|
73
|
-
"@univerjs-infra/shared": "0.6.
|
|
74
|
-
"@univerjs/engine-render": "0.6.7"
|
|
74
|
+
"@univerjs-infra/shared": "0.6.9"
|
|
75
75
|
},
|
|
76
76
|
"scripts": {
|
|
77
77
|
"test": "vitest run",
|
package/LICENSE
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|