当前位置:网站首页>TinyMCE series (II) TinyMCE plug-in development
TinyMCE series (II) TinyMCE plug-in development
2022-06-12 11:43:00 【Jioho_】
List of articles
tinymce Plug-in development
The previous article has introduced tinymce Environment construction of , In fact, it's for tinymce Plug-in development Bedding made
Warehouse code :https://gitee.com/Jioho/tinymce-plugins
Developed later API Are subject to 5.x The main version is ( Now come out 6.x 了 ) It is mainly used by the company 5.x~
tinymce Plug in code writing style
With hr The plug-in is an example
The code style is summarized as follows , For reference ( Nonstandard , Documentation also does not address code style issues ):
- only one function function That is to say Plugin
- The entry method is also Plugin
- There's usually
Buttons、CommandsAnd so on , Summarize relevant methods - The button name is usually the same as the plug-in name
- The reduced code is as follows :
;(function() {
'use strict'
// adopt tinymce.util.Tools.resolve load tinymce Module
var global = tinymce.util.Tools.resolve('tinymce.PluginManager')
var register = function(editor) {
// Relevant business logic
editor.addCommand('InsertHorizontalRule', function() {
})
}
var Commands = {
register: register }
var register$1 = function(editor) {
// Button related business logic
editor.ui.registry.addButton('hr', {
...})
editor.ui.registry.addMenuItem('hr', {
...})
}
var Buttons = {
register: register$1 }
function Plugin() {
// global It's actually PluginManager
// adopt add Put the present hr Plug in registration to tinymce Plug in
global.add('hr', function(editor) {
// Register public methods
Commands.register(editor)
// register toolbar The button
Buttons.register(editor)
})
}
// The only method to execute after the plug-in is loaded
Plugin()
})
Plug in development file specification
Storage directory problem
The plug-in directories are all in src/js/tinymce/plugins Next . among src/js/tinymce For the download back tinymce The source package
Take my reference for example 
Plug in folder naming conventions
stay plugins Under the table of contents , Create a new one my_plugin Folder , that my_plugin This is the package name of the plug-in package
stay tinymce Initialization configuration plugins The configuration item is filled in with the package name to be imported
tinymce.init({
selector: 'textarea.tinymce',
plugins: 'my_plugin'
})
Plug in naming specification
Under the corresponding package name ,tinymce Load only plugin.js and plugin.min.js
The loading rules are as follows : On the business logic page If the introduction is tinymce.js Load the corresponding plug-in plugin.js file
If... Is introduced tinymce.min.js Load the corresponding plug-in plugin.min.js file
Last
This section briefly introduces tinymce The file specification of plug-in development is consistent with the code style , The next chapter is tinymce Commonly used API Introduce , Get started tinymce Plug-in development !
边栏推荐
猜你喜欢

【蓝桥杯单片机 国赛 第十一届】

Lambda and filter, index of list and numpy array, as well as various distance metrics, concatenated array and distinction between axis=0 and axis=1

C# 35. 选择默认网卡

Blue Bridge Cup 2015 CA provincial competition (filling the pit)

Mysql45 lecture 01 | infrastructure: how is an SQL query executed?

manuscript手稿格式准备

Byte order - how to judge the big end and the small end

Unity connect to Microsoft SQLSERVER database

Windows10安装mysql-8.0.28-winx64

Inter class and intra class relations in video classification -- regularization
随机推荐
Naming specification / annotation specification / logical specification
6.6 rl:mdp and reward function
网络的拓扑结构
Selenium uses proxy IP
【蓝桥杯单片机 国赛 第十一届】
FPGA Development - Hello_ World routine
FormatConversionTool. exe
[Blue Bridge Cup SCM 11th National race]
rosbridge使用案例心得总结之_第26篇在同一个服务器上打开多个rosbridge服务监听端口
邻居子系统之ARP协议数据处理过程
【QNX Hypervisor 2.2 用户手册】4.1 构建QNX Hypervisor系统的方法
Problems in cross validation code of 10% discount
多普勒效应的基本原理
6.6 separate convolution
Shardingjdbc-5.1.0 monthly horizontal table splitting + read-write separation, automatic table creation and node table refresh
Spark common encapsulation classes
为什么新品发布上架之后会没有流量,新品应该怎么发布?
套接字编程TCP篇
Pytorch笔记
UML series articles (30) architecture modeling -- product diagram