Though I would like to extend the page editor of Confluence cloud with TinyMCE plugin, Confluence cloud add-on cannot extend it directly like a Confluence Server.
So I decided to use 'content script' of browser extension (I used Chrome extension).
The 'content script' can access page contents via dom, but cannot access js global variables.
To refer them, it has to inject scripts that will be executed in page context into page contents.
Note that public sample of registering TinyMCE plugin for Confluence Server is not available as it is, because the editor of Confluence Cloud(as of now) uses TinyMCE4.
It can be resolved by using AJS.Rte.BootstrapManager
instead of tinymce-bootstrap
, as following,
require(['confluence/module-exporter', 'com/excelimport/plugins', 'tinymce'], function(ex, ExcelImportPlugin, tinymce) {
tinymce.create('tinymce.plugins.ExcelImportPlugin', ExcelImportPlugin);
tinymce.PluginManager.add('excelimport', tinymce.plugins.ExcelImportPlugin);
AJS.Rte.BootstrapManager.addTinyMcePluginInit(function(settings) {
settings.plugins += ",excelimport";
console.log(settings.plugins);
});
})
Additional note: In publishing Chrome addon, it will remains 'in review' unless you pay onetime registering fee($5). It is hard to notice it in new dashboard!