You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
6.7 KiB
2 lines
6.7 KiB
2 years ago
|
(window.webpackJsonp=window.webpackJsonp||[]).push([[35],{1569:function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return R}));var o=n(130),a=n.n(o),r=n(132),i=n.n(r),c=n(120),s=n.n(c),l=n(126),d=n.n(l),m=n(918),u=n(121),b=n(123);function p(e){let{onCancelClick:t,onSaveClick:n,isSaveDisabled:o=!1}=e;return s.a.createElement("div",{className:"mx_EditWysiwygComposer_buttons"},s.a.createElement(b.a,{kind:"secondary",onClick:t},Object(u.a)("Cancel")),s.a.createElement(b.a,{kind:"primary",onClick:n,disabled:o},Object(u.a)("Save")))}var g=n(124),f=n(128),y=n(138),v=n(237),O=n(642),j=n(336),C=n(402),E=n(312);var h=n(133),_=n(403),w=n(926);var T=n(453),k=n(252),x=n(125);function S(e){const t=Object(y.c)(),n=Object(h.b)();return Object(c.useMemo)((()=>{if(e&&t.room)return function(e,t,n){const o=new k.a(t,n);let a;if(e.hasEditorState())a=e.getSerializedParts().map((e=>o.deserializePart(e)));else{if("org.matrix.custom.html"===e.getEvent().getContent().format)return function(e){var t;return(null===(t=e.getEvent().getContent().formatted_body)||void 0===t?void 0:t.replace(/<mx-reply>.*<\/mx-reply>/,""))||""}(e);a=Object(T.b)(e.getEvent(),o,{shouldEscape:x.b.getValue("MessageComposerInput.useMarkdown")})}return a.reduce(((e,t)=>e+t.text),"")}(e,t.room,n)}),[e,t,n])}const M=["editorStateTransfer","className"],P=Object(c.forwardRef)((function(e,t){let{disabled:n=!1,composerFunctions:o}=e;return function(e,t,n){const o=Object(y.c)(),a=Object(E.c)(),r=Object(c.useRef)(null),i=Object(c.useCallback)((i=>{var c;if(e||!t.current)return;const s=null!==(c=i.context)&&void 0!==c?c:y.a.Room;switch(i.action){case f.a.FocusEditMessageComposer:Object(O.a)(t,s,o,r);break;case f.a.ComposerInsert:if(i.timelineRenderingType!==o.timelineRenderingType)break;if(i.composerType!==j.a.Edit)break;i.text&&Object(C.d)(a.selection).then((()=>n.insertText(i.text)))}}),[e,t,n,r,o,a]);Object(v.a)(g.a,i)}(n,t,o),null}));function R(e){let{editorStateTransfer:t,className:n}=e,o=i()(e,M);const r=Object(c.useRef)(Object(E.b)({editorStateTransfer:t})),l=S(t),u=!t||void 0!==l,{editMessage:b,endEditing:g,onChange:f,isSaveDisabled:v}=function(e,t){const n=Object(y.c)(),o=Object(h.b)(),[a,r]=Object(c.useState)(!0),[i,s]=Object(c.useState)(t);return{onChange:Object(c.useCallback)((e=>{s(e),r((n=>n&&e===t))}),[t]),editMessage:Object(c.useCallback)((()=>void 0!==i&&Object(w.editMessage)(i,{roomContext:n,mxClient:o,editorStateTransfer:e})),[i,n,o,e]),endEditing:Object(c.useCallback)((()=>Object(_.b)(n)),[n]),isSaveDisabled:a}}(t,l);return u?s.a.createElement(E.a.Provider,{value:r.current},s.a.createElement(m.a,a()({className:d()("mx_EditWysiwygComposer",n),initialContent:l,onChange:f,onSend:b},o),((e,t)=>s.a.createElement(s.a.Fragment,null,s.a.createElement(P,{disabled:o.disabled,ref:e,composerFunctions:t}),s.a.createElement(p,{onCancelClick:g,onSaveClick:b,isSaveDisabled:v}))))):null}},926:function(e,t,n){"use strict";n.r(t),n.d(t,"sendMessage",(function(){return _})),n.d(t,"editMessage",(function(){return w}));var o=n(132),a=n.n(o),r=n(170),i=n(189),c=n(125),s=n(452),l=n(270),d=n(247),m=n(308),u=n(124),b=n(377),p=n(403),g=n(13),f=n.n(g),y=n(643),v=n(136),O=n(227);function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function C(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?j(Object(n),!0).forEach((function(t){f()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}async function E(e,t,n){let{relation:o,replyToEvent:a,permalinkCreator:r,includeReplyLegacyFallback:i=!0,editedEvent:s}=n;const l=Boolean(s),d=l?Boolean(null==s?void 0:s.replyEventId):Boolean(a),m=l&&d,u=t?await Object(y.richToPlain)(e):e,b=m&&function(e){const t=e.getContent().body;if("string"!=typeof t)return"";const n=t.split("\n").map((
|
||
|
//# sourceMappingURL=35.js.map
|