@univerjs/docs-quick-insert-ui 0.6.7 → 0.6.8
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 +5 -5
- package/lib/es/index.js +397 -344
- package/lib/index.css +1 -1
- package/lib/index.js +646 -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 +5 -5
- package/package.json +13 -13
|
@@ -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,9 @@
|
|
|
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,ce,de,p,E,O,ue,S,f,b,h){"use strict";var xe=Object.defineProperty;var Ue=(o,s,M)=>s in o?xe(o,s,{enumerable:!0,configurable:!0,writable:!0,value:M}):o[s]=M;var P=(o,s,M)=>Ue(o,typeof s!="symbol"?s+"":s,M);const z={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}]})}},V="docs.quick.insert.keyword-input-placeholder",N=()=>{const i=p.useDependency(s.LocaleService);return f.jsx("div",{className:"univer-translate-y-1.5 univer-text-sm univer-text-gray-500",children:i.t("docQuickInsert.keywordInputPlaceholder")})};N.componentKey=V;const F="docs.quick.insert.placeholder",T=()=>{const i=p.useDependency(s.LocaleService);return f.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:f.jsx("span",{children:i.t("docQuickInsert.placeholder")})})};
|
|
4
|
+
`,children:f.jsx("span",{children:i.t("docQuickInsert.placeholder")})})};T.componentKey=F;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 G(i,n){return i.map(e=>{const t={...e};return"children"in t&&(t.children=G(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 ae=[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=h.useMemo(()=>s.generateRandomId(),[]),[a,v]=h.useState(0),m=h.useRef(null),d=h.useRef(0);d.current=0;const u=p.useObservable(n.filterKeyword$,""),l=p.useObservable(n.editPopup$),g=p.useObservable(l==null?void 0:l.popup.menus$,[]),w=h.useMemo(()=>G(g,i),[g]),[W,Qe]=h.useState(()=>K(w,u.toLowerCase()));h.useEffect(()=>{const I=requestIdleCallback(()=>{Qe(K(w,u.toLowerCase()))});return()=>{cancelIdleCallback(I)}},[w,u]);const re=I=>{n.emitMenuSelected(I),r.executeCommand(j.id)};h.useEffect(()=>{const I=new s.DisposableCollection;t.getAllShortcuts().filter(C=>C.binding&&ae.includes(C.binding)).forEach(C=>{const k=C.preconditions;C.preconditions=()=>!1,I.add(s.toDisposable(()=>{C.preconditions=k}))});const D={id:`quick.insert.popup.enter.${c}`,type:s.CommandType.OPERATION,handler:()=>{const C=m.current;C&&re(C)}},U={id:`quick.insert.popup.move.cursor.up.${c}`,type:s.CommandType.OPERATION,handler:()=>{v(C=>{const k=C-1;return k>=0?k:d.current-1})}},R={id:`quick.insert.popup.move.cursor.down.${c}`,type:s.CommandType.OPERATION,handler:()=>{v(C=>{const k=C+1;return k<=d.current-1?k:0})}};return I.add(r.registerCommand(U)),I.add(r.registerCommand(R)),I.add(r.registerCommand(D)),I.add(t.registerShortcut({priority:1e3,id:U.id,binding:p.KeyCode.ARROW_UP,preconditions:()=>!0,staticParameters:{direction:s.Direction.UP}})),I.add(t.registerShortcut({priority:1e3,id:R.id,binding:p.KeyCode.ARROW_DOWN,preconditions:()=>!0,staticParameters:{direction:s.Direction.DOWN}})),I.add(t.registerShortcut({priority:1e3,id:D.id,binding:p.KeyCode.ENTER,preconditions:()=>!0})),()=>{I.dispose()}},[]),h.useEffect(()=>{v(0)},[W]);function se(I){return I.map(y=>{const B=y.icon,D=B?e.get(B):null;if("children"in y)return f.jsx(b.MenuItemGroup,{title:f.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&&f.jsx("span",{className:"univer-mr-2 univer-inline-flex univer-text-base",children:f.jsx(D,{})}),f.jsx("span",{children:y.title})]}),children:se(y.children)},y.id);const U=d.current,R=a===U;return R&&(m.current=y),d.current++,f.jsx(b.MenuItem,{onMouseEnter:()=>v(U),onMouseLeave:()=>v(Number.NaN),className:b.clsx("univer-w-[calc(220px-var(--padding-base)*2)] univer-text-sm",{"hover:univer-bg-transparent":!R,"univer-bg-gray-100":R}),onClick:()=>{re(y)},children:f.jsxs("div",{className:"univer-flex univer-w-full univer-items-center univer-px-1",children:[D&&f.jsx("span",{className:"univer-mr-2 univer-inline-flex univer-text-base",children:f.jsx(D,{})}),f.jsx(b.Tooltip,{showIfEllipsis:!0,title:y.title,placement:"right",children:f.jsx("span",{className:"univer-truncate",children:y.title})})]})},y.id)})}const je=W.length>0,oe=(l==null?void 0:l.popup.Placeholder)||e.get(T.componentKey);return f.jsx("div",{className:b.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?f.jsx("div",{className:"univer-max-h-[360px] univer-w-[220px] univer-overflow-y-auto",children:f.jsx(b.Menu,{children:se(W)})}):oe&&f.jsx(oe,{})})};$.componentKey="docs.quick.insert.popup";var le=Object.getOwnPropertyDescriptor,pe=(i,n,e,t)=>{for(var r=t>1?void 0:t?le(n,e):n,c=i.length-1,a;c>=0;c--)(a=i[c])&&(r=a(r)||r);return r},Q=(i,n)=>(e,t)=>n(e,t,i);const Z={dispose:()=>{}};o.DocQuickInsertPopupService=class extends s.Disposable{constructor(e,t,r,c,a){super();P(this,"_popups",new Set);P(this,"_editPopup$",new S.BehaviorSubject(void 0));P(this,"editPopup$",this._editPopup$.asObservable());P(this,"_isComposing$",new S.BehaviorSubject(!1));P(this,"isComposing$",this._isComposing$.asObservable());P(this,"_inputOffset$",new S.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,g;return(g=(l=this._univerInstanceService.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_DOC))==null?void 0:l.getBody())==null?void 0:g.dataStream.slice(d,u)};let m="";this.filterKeyword$=this._inputOffset$.pipe(S.map(d=>{var l;const u=v(d.start,d.end);return(l=u==null?void 0:u.slice(1))!=null?l:""}),S.distinctUntilChanged(),S.tap(d=>{m=d})),this.disposeWithMe(S.combineLatest([this.filterKeyword$.pipe(S.tap(d=>{var u,l,g;d.length>0?(l=(u=this._inputPlaceholderRenderRoot)==null?void 0:u.unmount)==null||l.dispose():(g=this._inputPlaceholderRenderRoot)==null||g.mount()})),this.isComposing$.pipe(S.tap(d=>{var u,l,g;d?(l=(u=this._inputPlaceholderRenderRoot)==null?void 0:u.unmount)==null||l.dispose():m.length<=0&&((g=this._inputPlaceholderRenderRoot)==null||g.mount())})),this.editPopup$.pipe(S.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 w;const v=(w=this._renderManagerService.getRenderById(c))==null?void 0:w.with(E.DocSkeletonManagerService),m=this._docSelectionManagerService.getActiveTextRange();if(!v||!m)return Z;const u=v.getSkeleton().findNodeByCharIndex(m.startOffset,m.segmentId,m.segmentPage);if(!((u==null?void 0:u.content)==="\r"))return Z;const g=this._docCanvasPopupManagerService.attachPopupToRange({startOffset:r+1,endOffset:r+1,collapsed:!1},{componentKey:N.componentKey,onClickOutside:()=>{g.dispose()},direction:"horizontal"},c);return g}),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(z.id,{start:t,end:r}),setTimeout(()=>{this._menuSelectedCallbacks.forEach(c=>c(e))},0)}},o.DocQuickInsertPopupService=pe([Q(0,s.Inject(O.DocCanvasPopManagerService)),Q(1,s.Inject(s.IUniverInstanceService)),Q(2,s.Inject(s.ICommandService)),Q(3,s.Inject(ue.IRenderManagerService)),Q(4,s.Inject(E.DocSelectionManagerService))],o.DocQuickInsertPopupService);const J={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}},j={type:s.CommandType.OPERATION,id:"doc.operation.close-quick-insert-popup",handler(i){return i.get(o.DocQuickInsertPopupService).closePopup(),!0}},X={id:"quick-insert.text.menu",title:"docQuickInsert.menu.text",icon:"TextSingle",keywords:["text"]},Y={id:O.OrderListCommand.id,title:"docQuickInsert.menu.numberedList",icon:"OrderSingle",keywords:["numbered","list","ordered"]},ee={id:O.BulletListCommand.id,title:"docQuickInsert.menu.bulletedList",icon:"UnorderSingle",keywords:["bulleted","list","unordered"]},te={id:O.HorizontalLineCommand.id,title:"docQuickInsert.menu.divider",icon:"DividerSingle",keywords:["divider","line","separate"]},ve=[{title:"docQuickInsert.group.basics",id:"quick.insert.group.basic",children:[X,Y,ee,te]}],fe=new Set([Y.id,ee.id,te.id]);var he=Object.getOwnPropertyDescriptor,me=(i,n,e,t)=>{for(var r=t>1?void 0:t?he(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);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:j.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,m;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(J.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=(m=d.len)!=null?m: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(j.id)}if(n.id===O.DeleteLeftCommand.id){const d=t.getActiveTextRange();if(!e.editPopup||!d)return;d.endOffset<=e.editPopup.anchor&&r.executeCommand(j.id)}}}))}_initMenuHandler(){this.disposeWithMe(this._docQuickInsertPopupService.onMenuSelected(n=>{n.id!==X.id&&fe.has(n.id)&&this._commandService.executeCommand(n.id)}))}},o.DocQuickInsertTriggerController=me([x(0,s.ICommandService),x(1,s.Inject(E.DocSelectionManagerService)),x(2,s.Inject(o.DocQuickInsertPopupService)),x(3,s.Inject(p.IShortcutService)),x(4,s.Inject(s.IUniverInstanceService))],o.DocQuickInsertTriggerController);var _=function(){return _=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},_.apply(this,arguments)},ge=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=h.forwardRef(function(i,n){var e=i.icon,t=i.id,r=i.className,c=i.extend,a=ge(i,["icon","id","className","extend"]),v="univerjs-icon univerjs-icon-".concat(t," ").concat(r||"").trim(),m=h.useRef("_".concat(_e()));return ne(e,"".concat(t),{defIds:e.defIds,idSuffix:m.current},_({ref:n,className:v},a),c)});function ne(i,n,e,t,r){return h.createElement(i.tag,_(_({key:n},Ie(i,e,r)),t),(Ce(i,e).children||[]).map(function(c,a){return ne(c,"".concat(n,"-").concat(i.tag,"-").concat(a),e,void 0,r)}))}function Ie(i,n,e){var t=_({},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 Ce(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)?_(_({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&t&&t.indexOf(r.attrs.id)>-1?_(_({},r),{attrs:_(_({},r.attrs),{id:r.attrs.id+n.idSuffix})}):r})}):i}function _e(){return Math.random().toString(36).substring(2,8)}H.displayName="UniverIcon";var Se={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=h.forwardRef(function(i,n){return h.createElement(H,Object.assign({},i,{id:"divider-single",ref:n,icon:Se}))});q.displayName="DividerSingle";var ye={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=h.forwardRef(function(i,n){return h.createElement(H,Object.assign({},i,{id:"text-single",ref:n,icon:ye}))});L.displayName="TextSingle";var Pe=Object.getOwnPropertyDescriptor,Oe=(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},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(){[z,J,j].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$:S.of(ve),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=Oe([A(0,s.ICommandService),A(1,s.Inject(o.DocQuickInsertPopupService)),A(2,s.Inject(p.ComponentManager))],o.DocQuickInsertUIController);var De=Object.defineProperty,ke=Object.getOwnPropertyDescriptor,Me=(i,n,e)=>n in i?De(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?ke(n,e):n,c=i.length-1,a;c>=0;c--)(a=i[c])&&(r=a(r)||r);return r},we=(i,n)=>(e,t)=>n(e,t,i),ie=(i,n,e)=>Me(i,typeof n!="symbol"?n+"":n,e);const Re="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)}},ie(o.UniverDocsQuickInsertUIPlugin,"type",s.UniverInstanceType.UNIVER_DOC),ie(o.UniverDocsQuickInsertUIPlugin,"pluginName",Re),o.UniverDocsQuickInsertUIPlugin=be([s.DependentOn(de.UniverDrawingUIPlugin,ce.UniverDrawingPlugin,M.UniverDocsDrawingPlugin,p.UniverUIPlugin),we(0,s.Inject(s.Injector))],o.UniverDocsQuickInsertUIPlugin),o.KeywordInputPlaceholderComponentKey=V,o.QuickInsertPlaceholderComponentKey=F,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.8",
|
|
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/
|
|
58
|
-
"@univerjs/docs": "0.6.
|
|
59
|
-
"@univerjs/docs-
|
|
60
|
-
"@univerjs/
|
|
61
|
-
"@univerjs/drawing": "0.6.
|
|
62
|
-
"@univerjs/
|
|
63
|
-
"@univerjs/ui": "0.6.
|
|
55
|
+
"@univerjs/icons": "^0.2.31",
|
|
56
|
+
"@univerjs/core": "0.6.8",
|
|
57
|
+
"@univerjs/docs-drawing": "0.6.8",
|
|
58
|
+
"@univerjs/docs": "0.6.8",
|
|
59
|
+
"@univerjs/docs-ui": "0.6.8",
|
|
60
|
+
"@univerjs/design": "0.6.8",
|
|
61
|
+
"@univerjs/drawing-ui": "0.6.8",
|
|
62
|
+
"@univerjs/engine-render": "0.6.8",
|
|
63
|
+
"@univerjs/ui": "0.6.8",
|
|
64
|
+
"@univerjs/drawing": "0.6.8"
|
|
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.8"
|
|
75
75
|
},
|
|
76
76
|
"scripts": {
|
|
77
77
|
"test": "vitest run",
|