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.
amis/demo/scripts/chunk/6590.739ca6e3.js

2 lines
541 KiB

1 year ago
/*! For license information please see 6590.739ca6e3.js.LICENSE.txt */
(self.webpackChunkamis_editor_demo=self.webpackChunkamis_editor_demo||[]).push([[6590],{96590:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return l}});var r=n(97582),a=n(67294),o=n(98598),i=n.n(o),s=(n(32993),n(14884),n(1092),n(65452),n(22428),n(21342),n(22683),n(55137),n(68604),n(60483),n(92985),n(89916),n(43474),n(8051),n(63982),n(84907),n(76827),n(80020),n(41697),n(28496),n(29666),n(87866),n(60528),n(75626),n(96799),n(48950),n(68059),n(71159),n(50561),n(7909),function(e){function t(t){var n=e.call(this,t)||this;return n.listeningEvents=[],n.element=null,n.editor=null,n.config={immediateReactModelUpdate:!1,reactIgnoreAttrs:null},n.editorInitialized=!1,n.INNER_HTML_ATTR="innerHTML",n.oldModel=null,n}return(0,r.ZT)(t,e),t.prototype.componentDidMount=function(){this.createEditor()},t.prototype.componentWillUnmount=function(){this.destroyEditor()},t.prototype.componentDidUpdate=function(){JSON.stringify(this.oldModel)!=JSON.stringify(this.props.model)&&this.setContent()},t.prototype.clone=function(e){var t,n=this;if(!e)return e;if([Number,String,Boolean].forEach((function(n){e instanceof n&&(t=n(e))})),void 0===t)if("[object Array]"===Object.prototype.toString.call(e))t=[],e.forEach((function(e,r,a){t[r]=n.clone(e)}));else if("object"==typeof e)if(e.nodeType&&"function"==typeof e.cloneNode)t=e.cloneNode(!0);else if(e.prototype)t=e;else if(e instanceof Date)t=new Date(e);else for(var r in t={},e)t[r]=n.clone(e[r]);else t=e;return t},t.prototype.createEditor=function(){var e=this;this.editorInitialized||(this.config=this.clone(this.props.config||this.config),this.config=(0,r.pi)({},this.config),this.element=this.el,this.props.model&&(this.element.innerHTML=this.props.model),this.setContent(),this.registerEvent("initialized",this.config.events&&this.config.events.initialized),this.config.events||(this.config.events={}),this.config.events.initialized=function(){e.editorInitialized=!0,e.initListeners()},this.editor=new(i())(this.element,this.config))},t.prototype.setContent=function(){var e=this;(this.props.model||""==this.props.model)&&(this.oldModel=this.props.model,this.editorInitialized?this.setNormalTagContent():(this._initEvents||(this._initEvents=[]),this._initEvents.push((function(){return e.setNormalTagContent()}))))},t.prototype.setNormalTagContent=function(){var e=this;e.editor.html&&e.editor.html.set(e.props.model||""),e.editorInitialized&&e.editor.undo&&(e.editor.undo.reset(),e.editor.undo.saveStep())},t.prototype.destroyEditor=function(){this.element&&(this.editor.destroy&&this.editor.destroy(),this.listeningEvents.length=0,this.element=null,this.editorInitialized=!1,this._initEvents=[])},t.prototype.getEditor=function(){return this.element?this.editor:null},t.prototype.updateModel=function(){if(this.props.onModelChange){var e="",t=this.editor.html.get();"string"==typeof t&&(e=t),this.oldModel=e,this.props.onModelChange(e)}},t.prototype.initListeners=function(){var e=this;if(this.editor.events.on("contentChanged",(function(){e.updateModel()})),this.config.immediateReactModelUpdate&&this.editor.events.on("keyup",(function(){e.updateModel()})),this._initEvents)for(var t=0;t<this._initEvents.length;t++)this._initEvents[t].call(this.editor)},t.prototype.registerEvent=function(e,t){e&&t&&("initialized"==e?(this._initEvents||(this._initEvents=[]),this._initEvents.push(t)):(this.config.events||(this.config.events={}),this.config.events[e]=t))},t.prototype.render=function(){var e=this;return a.createElement("textarea",{ref:function(t){return e.el=t}},this.props.children)},t}(a.Component)),l=function(e){function t(t){var n=e.call(this,t)||this;return i().VIDEO_PROVIDERS=[{test_regex:/.*/,url_regex:"",url_text:"",html:'<span class="fr-video fr-dvb fr-draggable" contenteditable="false" draggable="true"><video class="fr-draggable" controls="" data-msg="ok" data-status="0" src="{url}" style="width: 600px;"></video></span>'}],n}return(0,r.ZT)(t,e),t.prototype.render=function(){return a.createElement(s,{config:this.props.config,model:this.props.model,onModelChange:this.props.onModelChange})},t}(a.Component)},98