1class TinyEditor extends TinyEditorBase { 2 constructor (params) { 3 console.log(params) 4 5 super(params); 6 this.params = params; 7 this.isSubmited = false; 8 this.sandbox = { inited: false }; 9 this.config = params; 10 this.editor = {}; 11 this.element = {}; 12 this.form = {}; 13 this.id = this.config.id; 14 this.selector = '#' + 'bxed_' + this.config.id; 15 16 if (!document.querySelector(this.selector)) { 17 var tag = document.createElement('textarea'); 18 tag.id = 'bxed_' + this.config.id; 19 tag.name = this.config.inputName; 20 tag.value = this.config.content; 21 var brother = document.querySelector('#' + 'div' + this.config.id); 22 if (brother) { 23 brother.parentNode.insertBefore(tag, brother); 24 } 25 } 26 var tag = document.createElement('style'); 27 tag.innerText = '#bx-html-editor-' + this.config.id + '{display: none !important}'; 28 document.head.appendChild(tag) 29 30 this.start(); 31 return this; 32 } 33 34 static create(params) { 35 if (params?.id == 'filesrc_pub') { 36 return new window.BXEditor(params); 37 } 38 else { 39 return new TinyEditor(params); 40 } 41 } 42 43 start() { 44 var _this = this; 45 46 var def = { 47 content_css: [], 48 content_style: 'body {padding: 10px !important; }', 49 selector: this.selector, 50 plugins: 'advlist anchor autolink autoresize autosave charmap code codesample directionality emoticons fullscreen help hr image imagetools importcss insertdatetime legacyoutput link lists media nonbreaking noneditable pagebreak paste preview print quickbars save searchreplace tabfocus table template textpattern toc visualblocks visualchars wordcount', 51 toolbar: 'formatselect | bold italic strikethrough forecolor backcolor permanentpen formatpainter | link image media pageembed template medialibrary | alignleft aligncenter alignright al
51ignjustify | numlist bullist outdent indent | removeformat | addcomment fullpage', 52 resize: 'both', 53 pagebreak_separator: "<BREAK />", 54 image_advtab: true, 55 importcss_append: true, 56 image_caption: true, 57 height: this.config.height, 58 tinycomments_mode: 'embedded', 59 body_class: 'text', 60 language: 'ru', 61 min_height: this.config.height, 62 convert_urls: false, 63 relative_urls: false, 64 theme_advanced_resizing: true, 65 theme_advanced_resizing_use_cookie: false, 66 valid_elements: '*[*]', 67 68 // Явно ÑазÑеÑиÑÑ full-page ÑÑÑÑкÑÑÑÑ Ð¸ опаÑнÑе/неÑÑандаÑÑнÑе ÑлеменÑÑ 69 extended_valid_elements: [ 70 'link[*]', 71 'style[*]', 72 'script[*]', 73 ].join(','), 74 75 images_upload_url: '/bitrix/tools/slytek.editor/upload.php', 76 //images_upload_base_path: '/upload/editor_images', 77 78 templates: "/bitrix/tools/slytek.editor/templates.php", 79 setup(editor) { 80 _this.editor = editor; 81 82 try { 83 _this.addButtons(); 84 } 85 catch (ex) { 86 console.log(ex) 87 } 88 editor.on('init', function (e) { 89 90 _this.sandbox.inited = true; 91 editor.show(); 92 _this.element = editor.getContainer(); 93 _this.form = _this.element.closest('form'); 94 95 BX.bind(_this.form, 'submit', BX.proxy(_this.OnSubmit, _this)); 96 try { 97 _this.callLegacy(); 98 } 99 catch (ex) { 100 console.log(ex) 101 } 102 _this.inited = true; 103 104 }); 105 } 106 } 107 108 if (this.config.componentFilter?.TYPE == 'mail') { 109 def.plugins += ' fullpage'; 110 def.extended_valid_elements = [ 111 'html[*]', 112 'head[*]', 113 'body[*]', 114 'meta[*]', 115 'link[*]', 116 'style[*]', 117 'script[*]', 118 'base[*]', 119 'title[*]' 120 ].join(','); 121 122 def.valid_children = [ 123 '+html[head|body]', 124 '+head[meta|title|base|link|style|script|noscript]', 125 '+body[style|script|link|meta]' 126 ].join(','); 127 } 128 129 if (!window.BXTinyConfig) { 130 window.BXTinyConfig = {}; 131 } 132 133 var config = Object.assign(def, window.BXTinyConfig); 134 if (!document.querySelector(config.selector)) { 135 136 } 137 var obj = tinymce.init(Object.assign(def, window.BXTinyConfig)); 138 139 140 } 141 Show() { 142 this.editor?.show(); 143 } 144 145 Hide() { 146 this.editor?.hide(); 147 } 148 Check() { 149 return true; 150 } 151 IsShown() { 152 return this.editor.initialized; 153 } 154 SetContent(value, bParse) { 155 156 } 157 SaveContent() { 158 159 } 160 AddButton() { 161 162 } 163 GetContent() { 164 this.SaveContent(); 165 return this.editor.getContent(); 166 } 167 168 IsContentChanged() { 169 var 170 cont1 = this.config.content.replace(/[\s\n\r\t]+/ig, ''), 171 cont2 = this.GetContent().replace(/[\s\n\r\t]+/ig, ''); 172 173 return cont1 != cont2; 174 } 175 176 IsSubmited() { 177 return this.isSubmited; 178 } 179 180 OnSubmit() { 181 if (!this.isSubmited) { 182 this.isSubmited = true; 183 } 184 } 185}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.