@univerjs/docs-quick-insert-ui 0.6.9 → 0.6.10-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +8 -6
- package/lib/cjs/locale/en-US.js +1 -1
- package/lib/cjs/locale/fa-IR.js +1 -1
- package/lib/cjs/locale/fr-FR.js +1 -1
- package/lib/cjs/locale/ru-RU.js +1 -1
- package/lib/cjs/locale/vi-VN.js +1 -1
- package/lib/cjs/locale/zh-CN.js +1 -1
- package/lib/cjs/locale/zh-TW.js +1 -1
- package/lib/es/index.js +479 -359
- package/lib/es/locale/en-US.js +3 -1
- package/lib/es/locale/fa-IR.js +3 -1
- package/lib/es/locale/fr-FR.js +3 -1
- package/lib/es/locale/ru-RU.js +3 -1
- package/lib/es/locale/vi-VN.js +5 -3
- package/lib/es/locale/zh-CN.js +3 -1
- package/lib/es/locale/zh-TW.js +3 -1
- package/lib/index.css +1 -1
- package/lib/index.js +479 -359
- package/lib/locale/en-US.js +3 -1
- package/lib/locale/fa-IR.js +3 -1
- package/lib/locale/fr-FR.js +3 -1
- package/lib/locale/ru-RU.js +3 -1
- package/lib/locale/vi-VN.js +5 -3
- package/lib/locale/zh-CN.js +3 -1
- package/lib/locale/zh-TW.js +3 -1
- package/lib/types/controllers/built-in-menus.d.ts +2 -0
- package/lib/types/controllers/doc-quick-insert-menu.controller.d.ts +14 -0
- package/lib/types/locale/zh-CN.d.ts +2 -0
- package/lib/types/plugin.d.ts +3 -1
- package/lib/types/services/doc-quick-insert-popup.service.d.ts +1 -0
- package/lib/types/views/menu/index.d.ts +23 -0
- package/lib/umd/index.js +8 -6
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +13 -12
package/lib/cjs/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var me=Object.defineProperty;var Ie=(r,t,e)=>t in r?me(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var S=(r,t,e)=>Ie(r,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@univerjs/core"),Ce=require("@univerjs/docs-drawing"),ne=require("@univerjs/docs-drawing-ui"),_e=require("@univerjs/drawing"),Se=require("@univerjs/drawing-ui"),J=require("@univerjs/engine-render"),p=require("@univerjs/ui"),I=require("@univerjs/docs-ui"),y=require("rxjs"),q=require("@univerjs/docs"),f=require("react/jsx-runtime"),w=require("@univerjs/design"),v=require("react"),re={id:"doc.command.delete-search-key",type:o.CommandType.COMMAND,handler:(r,t)=>{const e=r.get(o.ICommandService),{start:n,end:i}=t;return e.syncExecuteCommand(I.CutContentCommand.id,{segmentId:"",textRanges:[{startOffset:n,endOffset:n,collapsed:!0}],selections:[{startOffset:n,endOffset:i,collapsed:!1,direction:o.RANGE_DIRECTION.FORWARD}]})}},ie="docs.quick.insert.keyword-input-placeholder",T=()=>{const r=p.useDependency(o.LocaleService);return f.jsx("div",{className:"univer-translate-y-1.5 univer-text-sm univer-text-gray-500",children:r.t("docQuickInsert.keywordInputPlaceholder")})};T.componentKey=ie;const se={type:o.CommandType.OPERATION,id:"doc.operation.show-quick-insert-popup",handler(r,t){const e=r.get(exports.DocQuickInsertPopupService);return t?(e.showPopup(t),!0):!1}},E={type:o.CommandType.OPERATION,id:"doc.operation.close-quick-insert-popup",handler(r){return r.get(exports.DocQuickInsertPopupService).closePopup(),!0}},oe="docs.quick.insert.placeholder",K=()=>{const r=p.useDependency(o.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:
|
|
4
|
+
`,children:f.jsx("span",{children:r.t("docQuickInsert.placeholder")})})};K.componentKey=oe;function z(r,t){return r.map(e=>({...e})).filter(e=>{if("children"in e)return e.children=z(e.children,t),e.children.length>0;const n=e.keywords;return n?n.some(i=>i.includes(t)):e.title.toLowerCase().includes(t)})}function ce(r,t){return r.map(e=>{const n={...e};return"children"in n&&(n.children=ce(n.children,t)),n.title=t.t(n.title),"keywords"in n&&(n.keywords=n.keywords.concat(n.title).map(i=>i.toLowerCase())),n})}const ye=[p.KeyCode.ARROW_UP,p.KeyCode.ARROW_DOWN,p.KeyCode.ENTER],H=()=>{const r=p.useDependency(o.LocaleService),t=p.useDependency(exports.DocQuickInsertPopupService),e=p.useDependency(p.ComponentManager),n=p.useDependency(p.IShortcutService),i=p.useDependency(o.ICommandService),s=v.useMemo(()=>o.generateRandomId(),[]),[a,l]=v.useState(0),m=v.useRef(null),c=v.useRef(0);c.current=0;const u=p.useObservable(t.filterKeyword$,""),d=p.useObservable(t.editPopup$),g=p.useObservable(d==null?void 0:d.popup.menus$,[]),x=v.useMemo(()=>ce(g,r),[g]),[b,X]=v.useState(()=>z(x,u.toLowerCase()));v.useEffect(()=>{const C=requestIdleCallback(()=>{X(z(x,u.toLowerCase()))});return()=>{cancelIdleCallback(C)}},[x,u]);const D=C=>{t.emitMenuSelected(C),i.executeCommand(E.id)};v.useEffect(()=>{const C=new o.DisposableCollection;n.getAllShortcuts().filter(h=>h.binding&&ye.includes(h.binding)).forEach(h=>{const M=h.preconditions;h.preconditions=()=>!1,C.add(o.toDisposable(()=>{h.preconditions=M}))});const O={id:`quick.insert.popup.enter.${s}`,type:o.CommandType.OPERATION,handler:()=>{const h=m.current;h&&D(h)}},j={id:`quick.insert.popup.move.cursor.up.${s}`,type:o.CommandType.OPERATION,handler:()=>{l(h=>{const M=h-1;return M>=0?M:c.current-1})}},k={id:`quick.insert.popup.move.cursor.down.${s}`,type:o.CommandType.OPERATION,handler:()=>{l(h=>{const M=h+1;return M<=c.current-1?M:0})}};return C.add(i.registerCommand(j)),C.add(i.registerCommand(k)),C.add(i.registerCommand(O)),C.add(n.registerShortcut({priority:1e3,id:j.id,binding:p.KeyCode.ARROW_UP,preconditions:()=>!0,staticParameters:{direction:o.Direction.UP}})),C.add(n.registerShortcut({priority:1e3,id:k.id,binding:p.KeyCode.ARROW_DOWN,preconditions:()=>!0,staticParameters:{direction:o.Direction.DOWN}})),C.add(n.registerShortcut({priority:1e3,id:O.id,binding:p.KeyCode.ENTER,preconditions:()=>!0})),()=>{C.dispose()}},[]),v.useEffect(()=>{l(0)},[b]);const $=v.useRef(new Map);v.useEffect(()=>()=>{$.current.clear()},[]);function R(C){return C.map(_=>{const B=_.icon,O=B?e.get(B):null;if("children"in _)return f.jsx(w.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:[O&&f.jsx("span",{className:"univer-mr-2 univer-inline-flex univer-text-base",children:f.jsx(O,{})}),f.jsx("span",{children:_.title})]}),children:B(_.children)},_.id);const M=c.current,k=u===M;return k&&(h.current=_),c.current++,f.jsx(D.MenuItem,{onMouseEnter:()=>p(M),onMouseLeave:()=>p(Number.NaN),className:D.clsx("univer-w-[calc(220px-var(--padding-base)*2)] univer-text-sm",{"hover:univer-bg-transparent":!k,"univer-bg-gray-100":k}),onClick:()=>{W(_)},children:f.jsxs("div",{className:"univer-flex univer-w-full univer-items-center univer-px-1",children:[O&&f.jsx("span",{className:"univer-mr-2 univer-inline-flex univer-text-base",children:f.jsx(O,{})}),f.jsx(D.Tooltip,{showIfEllipsis:!0,title:_.title,placement:"right",children:f.jsx("span",{className:"univer-truncate",children:_.title})})]})},_.id)})}const oe=T.length>0,z=(d==null?void 0:d.popup.Placeholder)||e.get(U.componentKey);return f.jsx("div",{className:D.clsx(`
|
|
7
|
-
univer-
|
|
8
|
-
univer-shadow-
|
|
9
|
-
`),children:oe?f.jsx("div",{className:"univer-max-h-[360px] univer-w-[220px] univer-overflow-y-auto",children:f.jsx(D.Menu,{children:B(T)})}):z&&f.jsx(z,{})})};E.componentKey="docs.quick.insert.popup";var ve=Object.getOwnPropertyDescriptor,he=(i,t,e,n)=>{for(var r=n>1?void 0:n?ve(t,e):t,o=i.length-1,u;o>=0;o--)(u=i[o])&&(r=u(r)||r);return r},w=(i,t)=>(e,n)=>t(e,n,i);const V={dispose:()=>{}};exports.DocQuickInsertPopupService=class extends s.Disposable{constructor(e,n,r,o,u){super();S(this,"_popups",new Set);S(this,"_editPopup$",new y.BehaviorSubject(void 0));S(this,"editPopup$",this._editPopup$.asObservable());S(this,"_isComposing$",new y.BehaviorSubject(!1));S(this,"isComposing$",this._isComposing$.asObservable());S(this,"_inputOffset$",new y.BehaviorSubject({start:0,end:0}));S(this,"inputOffset$",this._inputOffset$.asObservable());S(this,"filterKeyword$");S(this,"_menuSelectedCallbacks",new Set);S(this,"_inputPlaceholderRenderRoot",null);this._docCanvasPopupManagerService=e,this._univerInstanceService=n,this._commandService=r,this._renderManagerService=o,this._docSelectionManagerService=u,this.disposeWithMe(this._editPopup$);const p=(c,a)=>{var d,m;return(m=(d=this._univerInstanceService.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_DOC))==null?void 0:d.getBody())==null?void 0:m.dataStream.slice(c,a)};let h="";this.filterKeyword$=this._inputOffset$.pipe(y.map(c=>{var d;const a=p(c.start,c.end);return(d=a==null?void 0:a.slice(1))!=null?d:""}),y.distinctUntilChanged(),y.tap(c=>{h=c})),this.disposeWithMe(y.combineLatest([this.filterKeyword$.pipe(y.tap(c=>{var a,d,m;c.length>0?(d=(a=this._inputPlaceholderRenderRoot)==null?void 0:a.unmount)==null||d.dispose():(m=this._inputPlaceholderRenderRoot)==null||m.mount()})),this.isComposing$.pipe(y.tap(c=>{var a,d,m;c?(d=(a=this._inputPlaceholderRenderRoot)==null?void 0:a.unmount)==null||d.dispose():h.length<=0&&((m=this._inputPlaceholderRenderRoot)==null||m.mount())})),this.editPopup$.pipe(y.tap(c=>{var a,d;c||((d=(a=this._inputPlaceholderRenderRoot)==null?void 0:a.unmount)==null||d.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(n=>n.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:n,index:r,unitId:o}=e;this.closePopup(),this._inputPlaceholderRenderRoot=this._createInputPlaceholderRenderRoot(()=>{var b;const p=(b=this._renderManagerService.getRenderById(o))==null?void 0:b.with(N.DocSkeletonManagerService),h=this._docSelectionManagerService.getActiveTextRange();if(!p||!h)return V;const a=p.getSkeleton().findNodeByCharIndex(h.startOffset,h.segmentId,h.segmentPage);if(!((a==null?void 0:a.content)==="\r"))return V;const m=this._docCanvasPopupManagerService.attachPopupToRange({startOffset:r+1,endOffset:r+1,collapsed:!1},{componentKey:Q.componentKey,onClickOutside:()=>{m.dispose()},direction:"horizontal"},o);return m}),this._inputPlaceholderRenderRoot.mount();const u=this._docCanvasPopupManagerService.attachPopupToRange({startOffset:r,endOffset:r,collapsed:!0},{componentKey:E.componentKey,onClickOutside:()=>{this.closePopup()},direction:"bottom"},o);this._editPopup$.next({disposable:u,popup:n,anchor:r,unitId:o})}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:n,end:r}=this.inputOffset;this._commandService.syncExecuteCommand(F.id,{start:n,end:r}),setTimeout(()=>{this._menuSelectedCallbacks.forEach(o=>o(e))},0)}};exports.DocQuickInsertPopupService=he([w(0,s.Inject(P.DocCanvasPopManagerService)),w(1,s.Inject(s.IUniverInstanceService)),w(2,s.Inject(s.ICommandService)),w(3,s.Inject(pe.IRenderManagerService)),w(4,s.Inject(N.DocSelectionManagerService))],exports.DocQuickInsertPopupService);const X={type:s.CommandType.OPERATION,id:"doc.operation.show-quick-insert-popup",handler(i,t){const e=i.get(exports.DocQuickInsertPopupService);return t?(e.showPopup(t),!0):!1}},j={type:s.CommandType.OPERATION,id:"doc.operation.close-quick-insert-popup",handler(i){return i.get(exports.DocQuickInsertPopupService).closePopup(),!0}},Y={id:"quick-insert.text.menu",title:"docQuickInsert.menu.text",icon:"TextSingle",keywords:["text"]},ee={id:P.OrderListCommand.id,title:"docQuickInsert.menu.numberedList",icon:"OrderSingle",keywords:["numbered","list","ordered"]},te={id:P.BulletListCommand.id,title:"docQuickInsert.menu.bulletedList",icon:"UnorderSingle",keywords:["bulleted","list","unordered"]},ne={id:P.HorizontalLineCommand.id,title:"docQuickInsert.menu.divider",icon:"DividerSingle",keywords:["divider","line","separate"]},me=[{title:"docQuickInsert.group.basics",id:"quick.insert.group.basic",children:[Y,ee,te,ne]}],ge=new Set([ee.id,te.id,ne.id]);var Ie=Object.getOwnPropertyDescriptor,Ce=(i,t,e,n)=>{for(var r=n>1?void 0:n?Ie(t,e):t,o=i.length-1,u;o>=0;o--)(u=i[o])&&(r=u(r)||r);return r},R=(i,t)=>(e,n)=>t(e,n,i);exports.DocQuickInsertTriggerController=class extends s.Disposable{constructor(t,e,n,r,o){super(),this._commandService=t,this._textSelectionManagerService=e,this._docQuickInsertPopupService=n,this._shortcutService=r,this._univerInstanceService=o,this.disposeWithMe(this._shortcutService.registerShortcut({id:j.id,binding:l.KeyCode.ESC,preconditions:()=>!!this._docQuickInsertPopupService.editPopup,priority:1e3})),this._initTrigger(),this._initMenuHandler()}_initTrigger(){this.disposeWithMe(this._commandService.onCommandExecuted(t=>{var u,p,h;const{_docQuickInsertPopupService:e,_textSelectionManagerService:n,_commandService:r}=this,o=this._univerInstanceService.getCurrentUnitOfType(s.UniverInstanceType.UNIVER_DOC);if(!(o!=null&&o.getDisabled())){if(t.id===P.InsertCommand.id){const c=t.params;if(e.editPopup){e.setInputOffset({start:e.inputOffset.start,end:c.range.endOffset+1});return}const a=n.getActiveTextRange();if(!a)return;const d=e.resolvePopup(c.body.dataStream);if(!d||!(d.preconditions?d.preconditions(c):!0))return;e.setInputOffset({start:a.startOffset-1,end:a.startOffset}),setTimeout(()=>{r.executeCommand(X.id,{index:a.startOffset-1,unitId:c.unitId,popup:d})},100)}if(t.id===P.IMEInputCommand.id){const c=t.params;!e.isComposing&&c.isCompositionStart&&e.setIsComposing(!0),e.isComposing&&c.isCompositionEnd&&e.setIsComposing(!1)}if(t.id===N.RichTextEditingMutation.id){const c=t.params;if(c.isCompositionEnd){const a=(p=(u=c.textRanges)==null?void 0:u[0])==null?void 0:p.endOffset;a&&e.setInputOffset({start:e.inputOffset.start,end:a})}}if(t.id===P.DeleteCommand.id){const c=t.params;if(e.editPopup&&c.direction===s.DeleteDirection.LEFT){const a=(h=c.len)!=null?h:0;e.setInputOffset({start:e.inputOffset.start,end:c.range.endOffset-a})}}if(t.id===P.MoveCursorOperation.id){const c=t.params;(c.direction===s.Direction.LEFT||c.direction===s.Direction.RIGHT)&&e.editPopup&&r.executeCommand(j.id)}if(t.id===P.DeleteLeftCommand.id){const c=n.getActiveTextRange();if(!e.editPopup||!c)return;c.endOffset<=e.editPopup.anchor&&r.executeCommand(j.id)}}}))}_initMenuHandler(){this.disposeWithMe(this._docQuickInsertPopupService.onMenuSelected(t=>{t.id!==Y.id&&ge.has(t.id)&&this._commandService.executeCommand(t.id)}))}};exports.DocQuickInsertTriggerController=Ce([R(0,s.ICommandService),R(1,s.Inject(N.DocSelectionManagerService)),R(2,s.Inject(exports.DocQuickInsertPopupService)),R(3,s.Inject(l.IShortcutService)),R(4,s.Inject(s.IUniverInstanceService))],exports.DocQuickInsertTriggerController);var C=function(){return C=Object.assign||function(i){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},C.apply(this,arguments)},_e=function(i,t){var e={};for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&t.indexOf(n)<0&&(e[n]=i[n]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,n=Object.getOwnPropertySymbols(i);r<n.length;r++)t.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(i,n[r])&&(e[n[r]]=i[n[r]]);return e},A=v.forwardRef(function(i,t){var e=i.icon,n=i.id,r=i.className,o=i.extend,u=_e(i,["icon","id","className","extend"]),p="univerjs-icon univerjs-icon-".concat(n," ").concat(r||"").trim(),h=v.useRef("_".concat(Pe()));return ie(e,"".concat(n),{defIds:e.defIds,idSuffix:h.current},C({ref:t,className:p},u),o)});function ie(i,t,e,n,r){return v.createElement(i.tag,C(C({key:t},Se(i,e,r)),n),(ye(i,e).children||[]).map(function(o,u){return ie(o,"".concat(t,"-").concat(i.tag,"-").concat(u),e,void 0,r)}))}function Se(i,t,e){var n=C({},i.attrs);e!=null&&e.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=e.colorChannel1),i.tag==="mask"&&n.id&&(n.id=n.id+t.idSuffix),Object.entries(n).forEach(function(o){var u=o[0],p=o[1];u==="mask"&&typeof p=="string"&&(n[u]=p.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))});var r=t.defIds;return!r||r.length===0||(i.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+t.idSuffix),Object.entries(n).forEach(function(o){var u=o[0],p=o[1];typeof p=="string"&&(n[u]=p.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function ye(i,t){var e,n=t.defIds;return!n||n.length===0?i:i.tag==="defs"&&(!((e=i.children)===null||e===void 0)&&e.length)?C(C({},i),{children:i.children.map(function(r){return typeof r.attrs.id=="string"&&n&&n.indexOf(r.attrs.id)>-1?C(C({},r),{attrs:C(C({},r.attrs),{id:r.attrs.id+t.idSuffix})}):r})}):i}function Pe(){return Math.random().toString(36).substring(2,8)}A.displayName="UniverIcon";var Oe={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=v.forwardRef(function(i,t){return v.createElement(A,Object.assign({},i,{id:"divider-single",ref:t,icon:Oe}))});q.displayName="DividerSingle";var xe={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=v.forwardRef(function(i,t){return v.createElement(A,Object.assign({},i,{id:"text-single",ref:t,icon:xe}))});L.displayName="TextSingle";var be=Object.getOwnPropertyDescriptor,ke=(i,t,e,n)=>{for(var r=n>1?void 0:n?be(t,e):t,o=i.length-1,u;o>=0;o--)(u=i[o])&&(r=u(r)||r);return r},K=(i,t)=>(e,n)=>t(e,n,i);exports.DocQuickInsertUIController=class extends s.Disposable{constructor(t,e,n){super(),this._commandService=t,this._docQuickInsertPopupService=e,this._componentManager=n,this._initCommands(),this._initComponents(),this._initMenus()}_initCommands(){[F,X,j].forEach(t=>{this.disposeWithMe(this._commandService.registerCommand(t))})}_initComponents(){[[E.componentKey,E],[Q.componentKey,Q],[U.componentKey,U],[q.displayName,q],[L.displayName,L]].forEach(([e,n])=>{e&&this.disposeWithMe(this._componentManager.register(e,n))}),[{keyword:"/",menus$:y.of(me),preconditions:e=>{var n;return((n=e.range.startNodePosition)==null?void 0:n.glyph)===0}}].forEach(e=>{this.disposeWithMe(this._docQuickInsertPopupService.registerPopup(e))})}_initMenus(){}};exports.DocQuickInsertUIController=ke([K(0,s.ICommandService),K(1,s.Inject(exports.DocQuickInsertPopupService)),K(2,s.Inject(l.ComponentManager))],exports.DocQuickInsertUIController);var De=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,we=(i,t,e)=>t in i?De(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Re=(i,t,e,n)=>{for(var r=n>1?void 0:n?Me(t,e):t,o=i.length-1,u;o>=0;o--)(u=i[o])&&(r=u(r)||r);return r},je=(i,t)=>(e,n)=>t(e,n,i),re=(i,t,e)=>we(i,typeof t!="symbol"?t+"":t,e);const Qe="DOC_QUICK_INSERT_UI_PLUGIN";exports.UniverDocsQuickInsertUIPlugin=class extends s.Plugin{constructor(t){super(),this._injector=t}onStarting(){[[exports.DocQuickInsertUIController],[exports.DocQuickInsertTriggerController],[exports.DocQuickInsertPopupService]].forEach(e=>this._injector.add(e)),this._injector.get(exports.DocQuickInsertUIController)}onRendered(){this._injector.get(exports.DocQuickInsertTriggerController),this._injector.get(exports.DocQuickInsertPopupService)}};re(exports.UniverDocsQuickInsertUIPlugin,"type",s.UniverInstanceType.UNIVER_DOC);re(exports.UniverDocsQuickInsertUIPlugin,"pluginName",Qe);exports.UniverDocsQuickInsertUIPlugin=Re([s.DependentOn(le.UniverDrawingUIPlugin,de.UniverDrawingPlugin,ue.UniverDocsDrawingPlugin,l.UniverUIPlugin),je(0,s.Inject(s.Injector))],exports.UniverDocsQuickInsertUIPlugin);exports.KeywordInputPlaceholderComponentKey=G;exports.QuickInsertPlaceholderComponentKey=Z;
|
|
6
|
+
`,children:[O&&f.jsx("span",{className:"univer-mr-2 univer-inline-flex univer-text-base",children:f.jsx(O,{})}),f.jsx("span",{children:_.title})]}),children:R(_.children)},_.id);const j=c.current,k=a===j;if(k){m.current=_;const h=$.current.get(_.id);h==null||h.scrollIntoView({block:"nearest"})}return c.current++,f.jsx(w.MenuItem,{ref:h=>{h&&$.current.set(_.id,h)},onMouseEnter:()=>l(j),onMouseLeave:()=>l(Number.NaN),className:w.clsx("univer-w-[calc(220px-var(--padding-base)*2)] univer-text-sm",{"hover:univer-bg-transparent":!k,"univer-bg-gray-100":k}),onClick:()=>{D(_)},children:f.jsxs("div",{className:"univer-flex univer-w-full univer-items-center univer-px-1",children:[O&&f.jsx("span",{className:"univer-mr-2 univer-inline-flex univer-text-base",children:f.jsx(O,{})}),f.jsx(w.Tooltip,{showIfEllipsis:!0,title:_.title,placement:"right",children:f.jsx("span",{className:"univer-truncate",children:_.title})})]})},_.id)})}const N=b.length>0,Y=(d==null?void 0:d.popup.Placeholder)||e.get(K.componentKey);return f.jsx("div",{className:w.clsx("univer-mt-2"),children:N?f.jsx(w.Menu,{wrapperClass:"univer-max-h-[360px] univer-w-[220px]",children:R(b)}):Y&&f.jsx(Y,{})})};H.componentKey="docs.quick.insert.popup";var Pe=Object.getOwnPropertyDescriptor,xe=(r,t,e,n)=>{for(var i=n>1?void 0:n?Pe(t,e):t,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=a(i)||i);return i},Q=(r,t)=>(e,n)=>t(e,n,r);const ee={dispose:()=>{}};exports.DocQuickInsertPopupService=class extends o.Disposable{constructor(e,n,i,s,a){super();S(this,"_popups",new Set);S(this,"_editPopup$",new y.BehaviorSubject(void 0));S(this,"editPopup$",this._editPopup$.asObservable());S(this,"_isComposing$",new y.BehaviorSubject(!1));S(this,"isComposing$",this._isComposing$.asObservable());S(this,"_inputOffset$",new y.BehaviorSubject({start:0,end:0}));S(this,"inputOffset$",this._inputOffset$.asObservable());S(this,"filterKeyword$");S(this,"_menuSelectedCallbacks",new Set);S(this,"_inputPlaceholderRenderRoot",null);this._docCanvasPopupManagerService=e,this._univerInstanceService=n,this._commandService=i,this._renderManagerService=s,this._docSelectionManagerService=a,this.disposeWithMe(this._editPopup$);const l=(c,u)=>{var d,g;return(g=(d=this._univerInstanceService.getCurrentUnitOfType(o.UniverInstanceType.UNIVER_DOC))==null?void 0:d.getBody())==null?void 0:g.dataStream.slice(c,u)};let m="";this.filterKeyword$=this._inputOffset$.pipe(y.map(c=>{var d;const u=l(c.start,c.end);return(d=u==null?void 0:u.slice(1))!=null?d:""}),y.distinctUntilChanged(),y.tap(c=>{m=c})),this.disposeWithMe(y.combineLatest([this.filterKeyword$.pipe(y.tap(c=>{var u,d,g;c.length>0?(d=(u=this._inputPlaceholderRenderRoot)==null?void 0:u.unmount)==null||d.dispose():(g=this._inputPlaceholderRenderRoot)==null||g.mount()})),this.isComposing$.pipe(y.tap(c=>{var u,d,g;c?(d=(u=this._inputPlaceholderRenderRoot)==null?void 0:u.unmount)==null||d.dispose():m.length<=0&&((g=this._inputPlaceholderRenderRoot)==null||g.mount())})),this.editPopup$.pipe(y.tap(c=>{var u,d;c||((d=(u=this._inputPlaceholderRenderRoot)==null?void 0:u.unmount)==null||d.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)}getDocEventManagerService(e){var n;return(n=this._renderManagerService.getRenderById(e))==null?void 0:n.with(I.DocEventManagerService)}resolvePopup(e){return Array.from(this._popups).find(n=>n.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 i=e();this.unmount={dispose:()=>{i.dispose(),this.isMounted=!1}}}}}showPopup(e){var u,d,g;const{popup:n,index:i,unitId:s}=e;this.closePopup();const a=this._univerInstanceService.getUnit(s),l=(d=(u=a==null?void 0:a.getBody())==null?void 0:u.paragraphs)==null?void 0:d.find(x=>x.startIndex>i);if(!l)return;const m=(g=this.getDocEventManagerService(s))==null?void 0:g.paragraphBounds.get(l.startIndex);if(!m)return;this._inputPlaceholderRenderRoot=this._createInputPlaceholderRenderRoot(()=>{var N;const x=(N=this._renderManagerService.getRenderById(s))==null?void 0:N.with(q.DocSkeletonManagerService),b=this._docSelectionManagerService.getActiveTextRange();if(!x||!b)return ee;const D=x.getSkeleton().findNodeByCharIndex(b.startOffset,b.segmentId,b.segmentPage);if(!((D==null?void 0:D.content)==="\r"))return ee;const R=this._docCanvasPopupManagerService.attachPopupToRange({startOffset:i+1,endOffset:i+1,collapsed:!1},{componentKey:T.componentKey,onClickOutside:()=>{R.dispose()},direction:"horizontal"},s);return R}),this._inputPlaceholderRenderRoot.mount();const c=this._docCanvasPopupManagerService.attachPopupToRect(m.firstLine,{componentKey:H.componentKey,onClickOutside:()=>{this.closePopup()},direction:"bottom"},s);this._editPopup$.next({disposable:c,popup:n,anchor:i,unitId:s})}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:n,end:i}=this.inputOffset;this._commandService.syncExecuteCommand(re.id,{start:n,end:i}),setTimeout(()=>{this._menuSelectedCallbacks.forEach(s=>s(e))},0)}};exports.DocQuickInsertPopupService=xe([Q(0,o.Inject(I.DocCanvasPopManagerService)),Q(1,o.Inject(o.IUniverInstanceService)),Q(2,o.Inject(o.ICommandService)),Q(3,o.Inject(J.IRenderManagerService)),Q(4,o.Inject(q.DocSelectionManagerService))],exports.DocQuickInsertPopupService);var P=function(){return P=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++){t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},P.apply(this,arguments)},be=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e},A=v.forwardRef(function(r,t){var e=r.icon,n=r.id,i=r.className,s=r.extend,a=be(r,["icon","id","className","extend"]),l="univerjs-icon univerjs-icon-".concat(n," ").concat(i||"").trim(),m=v.useRef("_".concat(De()));return ae(e,"".concat(n),{defIds:e.defIds,idSuffix:m.current},P({ref:t,className:l},a),s)});function ae(r,t,e,n,i){return v.createElement(r.tag,P(P({key:t},Oe(r,e,i)),n),(Me(r,e).children||[]).map(function(s,a){return ae(s,"".concat(t,"-").concat(r.tag,"-").concat(a),e,void 0,i)}))}function Oe(r,t,e){var n=P({},r.attrs);e!=null&&e.colorChannel1&&n.fill==="colorChannel1"&&(n.fill=e.colorChannel1),r.tag==="mask"&&n.id&&(n.id=n.id+t.idSuffix),Object.entries(n).forEach(function(s){var a=s[0],l=s[1];a==="mask"&&typeof l=="string"&&(n[a]=l.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))});var i=t.defIds;return!i||i.length===0||(r.tag==="use"&&n["xlink:href"]&&(n["xlink:href"]=n["xlink:href"]+t.idSuffix),Object.entries(n).forEach(function(s){var a=s[0],l=s[1];typeof l=="string"&&(n[a]=l.replace(/url\(#(.*)\)/,"url(#$1".concat(t.idSuffix,")")))})),n}function Me(r,t){var e,n=t.defIds;return!n||n.length===0?r:r.tag==="defs"&&(!((e=r.children)===null||e===void 0)&&e.length)?P(P({},r),{children:r.children.map(function(i){return typeof i.attrs.id=="string"&&n&&n.indexOf(i.attrs.id)>-1?P(P({},i),{attrs:P(P({},i.attrs),{id:i.attrs.id+t.idSuffix})}):i})}):r}function De(){return Math.random().toString(36).substring(2,8)}A.displayName="UniverIcon";var ke={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"}}]},F=v.forwardRef(function(r,t){return v.createElement(A,Object.assign({},r,{id:"divider-single",ref:t,icon:ke}))});F.displayName="DividerSingle";var we={tag:"svg",attrs:{fill:"none",viewBox:"0 0 16 16",width:"1em",height:"1em"},children:[{tag:"path",attrs:{fill:"currentColor",d:"M8.00033 2.66699C8.36852 2.66699 8.66699 2.96547 8.66699 3.33366V7.33366H12.667C13.0352 7.33366 13.3337 7.63214 13.3337 8.00033C13.3337 8.36852 13.0352 8.66699 12.667 8.66699H8.66699V12.667C8.66699 13.0352 8.36852 13.3337 8.00033 13.3337C7.63214 13.3337 7.33366 13.0352 7.33366 12.667V8.66699H3.33366C2.96547 8.66699 2.66699 8.36852 2.66699 8.00033C2.66699 7.63214 2.96547 7.33366 3.33366 7.33366H7.33366V3.33366C7.33366 2.96547 7.63214 2.66699 8.00033 2.66699Z",fillRule:"evenodd",clipRule:"evenodd"}}]},ue=v.forwardRef(function(r,t){return v.createElement(A,Object.assign({},r,{id:"plus-single",ref:t,icon:we}))});ue.displayName="PlusSingle";var Re={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"}}]},G=v.forwardRef(function(r,t){return v.createElement(A,Object.assign({},r,{id:"text-single",ref:t,icon:Re}))});G.displayName="TextSingle";const L=({className:r=""})=>{const t=p.useDependency(exports.DocQuickInsertPopupService),e=p.useDependency(o.IUniverInstanceService),n=p.useDependency(J.IRenderManagerService),i=p.useObservable(v.useMemo(()=>e.getCurrentTypeOfUnit$(o.UniverInstanceType.UNIVER_DOC),[e])),s=i&&n.getRenderById(i.getUnitId()),a=s==null?void 0:s.with(I.DocEventManagerService),l=p.useObservable(a==null?void 0:a.hoverParagraph$),m=p.useObservable(a==null?void 0:a.hoverParagraphLeft$),c=()=>{var g;const u=l!=null?l:m;if(!u)return;const d=t.resolvePopup("/");d&&t.showPopup({popup:d,index:u.startIndex-1,unitId:(g=i==null?void 0:i.getUnitId())!=null?g:""})};return f.jsx("div",{className:`
|
|
7
|
+
univer-mr-1 univer-flex univer-cursor-pointer univer-items-center univer-gap-2.5 univer-rounded-full
|
|
8
|
+
univer-border univer-border-gray-200 univer-bg-white univer-p-1.5 univer-shadow-sm
|
|
9
|
+
hover:univer-bg-gray-100
|
|
10
|
+
${r}
|
|
11
|
+
`,onClick:c,role:"button",tabIndex:0,children:f.jsx(ue,{className:"univer-text-gray-800"})})};L.componentKey="doc.quick-insert.button";var je=Object.getOwnPropertyDescriptor,Qe=(r,t,e,n)=>{for(var i=n>1?void 0:n?je(t,e):t,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=a(i)||i);return i},W=(r,t)=>(e,n)=>t(e,n,r);let Z=class extends o.Disposable{constructor(t,e,n,i){super();S(this,"_popup",null);this._context=t,this._docEventManagerService=e,this._docQuickInsertPopupService=n,this._docCanvasPopManagerService=i,this._init()}_init(){this.disposeWithMe(y.combineLatest([this._docEventManagerService.hoverParagraphLeft$,this._docEventManagerService.hoverParagraph$]).subscribe(([t,e])=>{var i;const n=t!=null?t:e;if(!n){this._hideMenu(!0);return}if(n.paragraphStart===n.paragraphEnd&&n.startIndex!==((i=this._popup)==null?void 0:i.startIndex)){this._hideMenu(!0);const s=this._docCanvasPopManagerService.attachPopupToRect(n.firstLine,{componentKey:L.componentKey,direction:"left-center"},this._context.unit.getUnitId());this._popup={startIndex:n.startIndex,disposable:s}}else this._hideMenu(!0)}))}_hideMenu(t){this._popup&&(t||this._popup.disposable.canDispose())&&(this._popup.disposable.dispose(),this._popup=null)}};Z=Qe([W(1,o.Inject(I.DocEventManagerService)),W(2,o.Inject(exports.DocQuickInsertPopupService)),W(3,o.Inject(I.DocCanvasPopManagerService))],Z);const de={id:"quick-insert.text.menu",title:"docQuickInsert.menu.text",icon:"TextSingle",keywords:["text"]},pe={id:I.OrderListCommand.id,title:"docQuickInsert.menu.numberedList",icon:"OrderSingle",keywords:["numbered","list","ordered"]},le={id:I.BulletListCommand.id,title:"docQuickInsert.menu.bulletedList",icon:"UnorderSingle",keywords:["bulleted","list","unordered"]},ve={id:I.HorizontalLineCommand.id,title:"docQuickInsert.menu.divider",icon:"DividerSingle",keywords:["divider","line","separate"]},he={id:I.DocCreateTableOperation.id,title:"docQuickInsert.menu.table",icon:"GridSingle",keywords:["table","grid","spreadsheet"]},fe={id:ne.InsertDocImageCommand.id,title:"docQuickInsert.menu.image",icon:"addition-and-subtraction-single",keywords:["image","picture","photo"]},Ue=[{title:"docQuickInsert.group.basics",id:"quick.insert.group.basic",children:[de,pe,le,ve,he,fe]}],Ee=new Set([pe.id,le.id,ve.id,he.id,fe.id]);var $e=Object.getOwnPropertyDescriptor,Ne=(r,t,e,n)=>{for(var i=n>1?void 0:n?$e(t,e):t,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=a(i)||i);return i},U=(r,t)=>(e,n)=>t(e,n,r);exports.DocQuickInsertTriggerController=class extends o.Disposable{constructor(t,e,n,i,s){super(),this._commandService=t,this._textSelectionManagerService=e,this._docQuickInsertPopupService=n,this._shortcutService=i,this._univerInstanceService=s,this.disposeWithMe(this._shortcutService.registerShortcut({id:E.id,binding:p.KeyCode.ESC,preconditions:()=>!!this._docQuickInsertPopupService.editPopup,priority:1e3})),this._initTrigger(),this._initMenuHandler()}_initTrigger(){this.disposeWithMe(this._commandService.onCommandExecuted(t=>{var a,l,m;const{_docQuickInsertPopupService:e,_textSelectionManagerService:n,_commandService:i}=this,s=this._univerInstanceService.getCurrentUnitOfType(o.UniverInstanceType.UNIVER_DOC);if(!(s!=null&&s.getDisabled())){if(t.id===I.InsertCommand.id){const c=t.params;if(e.editPopup){e.setInputOffset({start:e.inputOffset.start,end:c.range.endOffset+1});return}const u=n.getActiveTextRange();if(!u)return;const d=e.resolvePopup(c.body.dataStream);if(!d||!(d.preconditions?d.preconditions(c):!0))return;e.setInputOffset({start:u.startOffset-1,end:u.startOffset}),setTimeout(()=>{i.executeCommand(se.id,{index:u.startOffset-1,unitId:c.unitId,popup:d})},100)}if(t.id===I.IMEInputCommand.id){const c=t.params;!e.isComposing&&c.isCompositionStart&&e.setIsComposing(!0),e.isComposing&&c.isCompositionEnd&&e.setIsComposing(!1)}if(t.id===q.RichTextEditingMutation.id){const c=t.params;if(c.isCompositionEnd){const u=(l=(a=c.textRanges)==null?void 0:a[0])==null?void 0:l.endOffset;u&&e.setInputOffset({start:e.inputOffset.start,end:u})}}if(t.id===I.DeleteCommand.id){const c=t.params;if(e.editPopup&&c.direction===o.DeleteDirection.LEFT){const u=(m=c.len)!=null?m:0;e.setInputOffset({start:e.inputOffset.start,end:c.range.endOffset-u})}}if(t.id===I.MoveCursorOperation.id){const c=t.params;(c.direction===o.Direction.LEFT||c.direction===o.Direction.RIGHT)&&e.editPopup&&i.executeCommand(E.id)}if(t.id===I.DeleteLeftCommand.id){const c=n.getActiveTextRange();if(!e.editPopup||!c)return;c.endOffset<=e.editPopup.anchor&&i.executeCommand(E.id)}}}))}_initMenuHandler(){this.disposeWithMe(this._docQuickInsertPopupService.onMenuSelected(t=>{t.id!==de.id&&Ee.has(t.id)&&this._commandService.executeCommand(t.id)}))}};exports.DocQuickInsertTriggerController=Ne([U(0,o.ICommandService),U(1,o.Inject(q.DocSelectionManagerService)),U(2,o.Inject(exports.DocQuickInsertPopupService)),U(3,o.Inject(p.IShortcutService)),U(4,o.Inject(o.IUniverInstanceService))],exports.DocQuickInsertTriggerController);var Te=Object.getOwnPropertyDescriptor,Ke=(r,t,e,n)=>{for(var i=n>1?void 0:n?Te(t,e):t,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=a(i)||i);return i},V=(r,t)=>(e,n)=>t(e,n,r);exports.DocQuickInsertUIController=class extends o.Disposable{constructor(t,e,n){super(),this._commandService=t,this._docQuickInsertPopupService=e,this._componentManager=n,this._initCommands(),this._initComponents(),this._initMenus()}_initCommands(){[re,se,E].forEach(t=>{this.disposeWithMe(this._commandService.registerCommand(t))})}_initComponents(){[[H.componentKey,H],[T.componentKey,T],[K.componentKey,K],[F.displayName,F],[G.displayName,G],[L.componentKey,L]].forEach(([e,n])=>{e&&this.disposeWithMe(this._componentManager.register(e,n))}),[{keyword:"/",menus$:y.of(Ue),preconditions:e=>{var n;return((n=e.range.startNodePosition)==null?void 0:n.glyph)===0}}].forEach(e=>{this.disposeWithMe(this._docQuickInsertPopupService.registerPopup(e))})}_initMenus(){}};exports.DocQuickInsertUIController=Ke([V(0,o.ICommandService),V(1,o.Inject(exports.DocQuickInsertPopupService)),V(2,o.Inject(p.ComponentManager))],exports.DocQuickInsertUIController);var He=Object.defineProperty,Le=Object.getOwnPropertyDescriptor,qe=(r,t,e)=>t in r?He(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ae=(r,t,e,n)=>{for(var i=n>1?void 0:n?Le(t,e):t,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=a(i)||i);return i},te=(r,t)=>(e,n)=>t(e,n,r),ge=(r,t,e)=>qe(r,typeof t!="symbol"?t+"":t,e);const Be="DOC_QUICK_INSERT_UI_PLUGIN";exports.UniverDocsQuickInsertUIPlugin=class extends o.Plugin{constructor(t,e){super(),this._injector=t,this._renderManagerSrv=e}onStarting(){[[exports.DocQuickInsertUIController],[exports.DocQuickInsertTriggerController],[exports.DocQuickInsertPopupService]].forEach(e=>this._injector.add(e)),this._injector.get(exports.DocQuickInsertUIController)}onRendered(){this._injector.get(exports.DocQuickInsertTriggerController),this._injector.get(exports.DocQuickInsertPopupService),[[Z]].forEach(t=>{this._renderManagerSrv.registerRenderModule(o.UniverInstanceType.UNIVER_DOC,t)})}};ge(exports.UniverDocsQuickInsertUIPlugin,"type",o.UniverInstanceType.UNIVER_DOC);ge(exports.UniverDocsQuickInsertUIPlugin,"pluginName",Be);exports.UniverDocsQuickInsertUIPlugin=Ae([o.DependentOn(Se.UniverDrawingUIPlugin,_e.UniverDrawingPlugin,ne.UniverDocsDrawingUIPlugin,Ce.UniverDocsDrawingPlugin,p.UniverUIPlugin),te(0,o.Inject(o.Injector)),te(1,o.Inject(J.IRenderManagerService))],exports.UniverDocsQuickInsertUIPlugin);exports.KeywordInputPlaceholderComponentKey=ie;exports.QuickInsertPlaceholderComponentKey=oe;
|
package/lib/cjs/locale/en-US.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e={docQuickInsert:{menu:{numberedList:"Numbered List",bulletedList:"Bulleted List",divider:"Divider",text:"Text"},group:{basics:"Basics"},placeholder:"No results found",keywordInputPlaceholder:"Enter keywords"}};module.exports=e;
|
|
1
|
+
"use strict";const e={docQuickInsert:{menu:{numberedList:"Numbered List",bulletedList:"Bulleted List",divider:"Divider",text:"Text",table:"Table",image:"Image"},group:{basics:"Basics"},placeholder:"No results found",keywordInputPlaceholder:"Enter keywords"}};module.exports=e;
|
package/lib/cjs/locale/fa-IR.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e={docQuickInsert:{menu:{numberedList:"لیست شمارهدار",bulletedList:"لیست نقطهدار",divider:"خط تقسیم",text:"متن"},group:{basics:"بنیادی"},placeholder:"هیچ نتیجهای یافت نشد",keywordInputPlaceholder:"وارد کلمات کلیدی"}};module.exports=e;
|
|
1
|
+
"use strict";const e={docQuickInsert:{menu:{numberedList:"لیست شمارهدار",bulletedList:"لیست نقطهدار",divider:"خط تقسیم",text:"متن",table:"جدول",image:"تصویر"},group:{basics:"بنیادی"},placeholder:"هیچ نتیجهای یافت نشد",keywordInputPlaceholder:"وارد کلمات کلیدی"}};module.exports=e;
|
package/lib/cjs/locale/fr-FR.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e={docQuickInsert:{menu:{numberedList:"Liste numérotée",bulletedList:"Liste à puces",divider:"Ligne de séparation",text:"Texte"},group:{basics:"Basiques"},placeholder:"Aucun résultat",keywordInputPlaceholder:"Entrez des mots clés"}};module.exports=e;
|
|
1
|
+
"use strict";const e={docQuickInsert:{menu:{numberedList:"Liste numérotée",bulletedList:"Liste à puces",divider:"Ligne de séparation",text:"Texte",table:"Tableau",image:"Image"},group:{basics:"Basiques"},placeholder:"Aucun résultat",keywordInputPlaceholder:"Entrez des mots clés"}};module.exports=e;
|
package/lib/cjs/locale/ru-RU.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e={docQuickInsert:{menu:{numberedList:"Список с нумерацией",bulletedList:"Маркированный список",divider:"Разделительная линия",text:"Текст"},group:{basics:"Основные"},placeholder:"Нет результатов",keywordInputPlaceholder:"Введите ключевые слова"}};module.exports=e;
|
|
1
|
+
"use strict";const e={docQuickInsert:{menu:{numberedList:"Список с нумерацией",bulletedList:"Маркированный список",divider:"Разделительная линия",text:"Текст",table:"Таблица",image:"Изображение"},group:{basics:"Основные"},placeholder:"Нет результатов",keywordInputPlaceholder:"Введите ключевые слова"}};module.exports=e;
|
package/lib/cjs/locale/vi-VN.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const n={docQuickInsert:{menu:{numberedList:"Danh sách được đánh số",bulletedList:"Danh sách không được đánh số",divider:"Đường phân cách",text:"Văn bản",table:"Bảng",image:"Hình ảnh"},group:{basics:"Cơ bản"},placeholder:"Không có kết quả",keywordInputPlaceholder:"Nhập từ khóa"}};module.exports=n;
|
package/lib/cjs/locale/zh-CN.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e={docQuickInsert:{menu:{numberedList:"有序列表",bulletedList:"无序列表",divider:"分隔线",text:"文本"},group:{basics:"基础"},placeholder:"暂无结果",keywordInputPlaceholder:"输入关键词"}};module.exports=e;
|
|
1
|
+
"use strict";const e={docQuickInsert:{menu:{numberedList:"有序列表",bulletedList:"无序列表",divider:"分隔线",text:"文本",table:"表格",image:"图片"},group:{basics:"基础"},placeholder:"暂无结果",keywordInputPlaceholder:"输入关键词"}};module.exports=e;
|
package/lib/cjs/locale/zh-TW.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e={docQuickInsert:{menu:{numberedList:"有序列表",bulletedList:"無序列表",divider:"分隔線",text:"文本"},group:{basics:"基礎"},placeholder:"無結果",keywordInputPlaceholder:"輸入關鍵詞"}};module.exports=e;
|
|
1
|
+
"use strict";const e={docQuickInsert:{menu:{numberedList:"有序列表",bulletedList:"無序列表",divider:"分隔線",text:"文本",table:"表格",image:"圖片"},group:{basics:"基礎"},placeholder:"無結果",keywordInputPlaceholder:"輸入關鍵詞"}};module.exports=e;
|