$59 GRAYBYTE WORDPRESS FILE MANAGER $94

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/home/bqrcodec/contact.groupg.com.sg/wp-content/plugins/code-snippets-pro/js/

HOME
Current File : /home/bqrcodec/contact.groupg.com.sg/wp-content/plugins/code-snippets-pro/js//mce.ts
import * as tinymce from 'tinymce'
import { Editor } from 'tinymce'

interface SourceShortcodeOps {
	id: string
	line_numbers: boolean
}

interface ContentShortcodeOps {
	id: string
	php: boolean
	format: boolean
	shortcodes: boolean
}

interface WordPressEditor extends Editor {
	getLang: (s: string) => string | Record<string, string>
}

const convertToValues = (array: Record<string, string>) =>
	Object.keys(array).map(key => ({
		text: array[Number(key)],
		value: key
	}))

const insertContentMenu = (editor: Editor, activeEditor: WordPressEditor) => ({
	text: activeEditor.getLang('code_snippets.insert_source_menu'),
	onclick: () => {
		editor.windowManager.open({
			title: activeEditor.getLang('code_snippets.insert_source_title'),
			body: [
				{
					type: 'listbox',
					name: 'id',
					label: activeEditor.getLang('code_snippets.snippet_label'),
					values: convertToValues(activeEditor.getLang('code_snippets.all_snippets') as Record<string, string>),
				},
				{
					type: 'checkbox',
					name: 'line_numbers',
					label: activeEditor.getLang('code_snippets.show_line_numbers_label'),
				}
			],
			onsubmit: (event: { data: SourceShortcodeOps }) => {
				const id = parseInt(event.data.id, 10)
				if (!id) return

				let atts = ''

				if (event.data.line_numbers) {
					atts += ' line_numbers=true'
				}

				editor.insertContent(`[code_snippet_source id=${id}${atts}]`)
			}
		}, {})
	}
})

const insertSourceMenu = (editor: Editor, ed: WordPressEditor) => ({
	text: ed.getLang('code_snippets.insert_content_menu'),
	onclick: () => {
		editor.windowManager.open({
			title: ed.getLang('code_snippets.insert_content_title'),
			body: [
				{
					type: 'listbox',
					name: 'id',
					label: ed.getLang('code_snippets.snippet_label'),
					values: convertToValues(ed.getLang('code_snippets.content_snippets') as Record<string, string>),
				},
				{
					type: 'checkbox',
					name: 'php',
					label: ed.getLang('code_snippets.php_att_label'),
				},
				{
					type: 'checkbox',
					name: 'format',
					label: ed.getLang('code_snippets.format_att_label'),
				},
				{
					type: 'checkbox',
					name: 'shortcodes',
					label: ed.getLang('code_snippets.shortcodes_att_label'),
				}
			],
			onsubmit: (event: { data: ContentShortcodeOps }) => {
				const id = parseInt(event.data.id, 10)
				if (!id) return

				let atts = ''

				for (const [opt, val] of Object.entries(event.data)) {
					if ('id' !== opt && val) {
						atts += ` ${opt}=${val}`
					}
				}

				editor.insertContent(`[code_snippet id=${id}${atts}]`)
			}
		}, {})
	}
})

tinymce.PluginManager.add('code_snippets', editor => {
	const activeEditor = tinymce.activeEditor as WordPressEditor

	editor.addButton('code_snippets', {
		icon: 'code',
		menu: [insertContentMenu(editor, activeEditor), insertSourceMenu(editor, activeEditor)],
		type: 'menubutton'
	})
})

Current_dir [ WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0755
blocks
--
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0755
edit
--
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0755
manage
--
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0755
settings
--
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0755
types
--
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0755
blocks.ts
0.264 KB
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0644
edit-tags.ts
0.073 KB
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0644
edit.ts
0.409 KB
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0644
editor.ts
0.394 KB
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0644
elementor.ts
0.396 KB
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0644
manage.ts
0.196 KB
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0644
mce.ts
2.807 KB
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0644
php-lint.ts
3.352 KB
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0644
prism.ts
0.883 KB
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0644
settings.ts
0.171 KB
6 Jun 2024 10.38 AM
bqrcodec / bqrcodec
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF