Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Item14288: added tinymce_native engien
- make lists work - make content_css work - auto-downgrade to engine tinymce_native if NOWYSIWYG is off - added switchToWYSIWYG event to tinymce plugin - generate legacy output by default -> SMELL: this is not HTML5 compatible
- Loading branch information
1 parent
fd9adbe
commit 1908535
Showing
10 changed files
with
308 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
NatEditPlugin/pub/System/NatEditPlugin/engine/tinymce_native/Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FOSWIKI_ROOT?=~/foswiki/core | ||
TARGET= engine.js | ||
|
||
-include $(FOSWIKI_ROOT)/pub/System/JQueryPlugin/Makefile.include |
102 changes: 102 additions & 0 deletions
102
NatEditPlugin/pub/System/NatEditPlugin/engine/tinymce_native/engine.uncompressed.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/* | ||
* jQuery NatEdit: tinymce native engine | ||
* | ||
* Copyright (c) 2017 Michael Daum http://michaeldaumconsulting.com | ||
* | ||
* Dual licensed under the MIT and GPL licenses: | ||
* http://www.opensource.org/licenses/mit-license.php | ||
* http://www.gnu.org/licenses/gpl.html | ||
* | ||
*/ | ||
|
||
/*global BaseEngine:false tinymce:false*/ | ||
|
||
"use strict"; | ||
(function($) { | ||
|
||
/***************************************************************************** | ||
* constructor | ||
*/ | ||
|
||
TinyMCENativeEngine.prototype = new BaseEngine(); | ||
TinyMCENativeEngine.prototype.constructor = TinyMCENativeEngine; | ||
TinyMCENativeEngine.prototype.parent = BaseEngine.prototype; | ||
|
||
function TinyMCENativeEngine(shell, opts) { | ||
var self = this; | ||
|
||
self.shell = shell; | ||
self.opts = $.extend({}, TinyMCENativeEngine.defaults, opts); | ||
self.opts.natedit.showToolbar = false; | ||
self.editor = tinymce.editors[0]; | ||
|
||
$.extend(self.shell.opts, self.opts.natedit); | ||
} | ||
|
||
/************************************************************************* | ||
* init gui | ||
*/ | ||
TinyMCENativeEngine.prototype.initGui = function() { | ||
var self = this, $txtarea = $(self.shell.txtarea); | ||
|
||
$txtarea.on("fwSwitchToRaw", function(/*ev, editor*/) { | ||
self.shell.showToolbar().then(function() { | ||
self.shell.toolbar.find(".ui-natedit-switch-to-wysiwyg").show(); | ||
}); | ||
}).on("fwSwitchToWYSIWYG", function() { | ||
self.shell.hideToolbar(); | ||
$(document).trigger("resize"); | ||
}); | ||
}; | ||
|
||
/************************************************************************* | ||
*/ | ||
TinyMCENativeEngine.prototype.switchToWYSIWYG = function(ev) { | ||
var self = this; | ||
|
||
self.editor.execCommand("fwSwitchToWYSIWYG"); | ||
}; | ||
|
||
/************************************************************************* | ||
* get the DOM element that holds the editor engine | ||
*/ | ||
TinyMCENativeEngine.prototype.getWrapperElement = function() { | ||
var self = this; | ||
|
||
return self.editor?$(self.editor.contentAreaContainer).children("iframe"):null; | ||
}; | ||
|
||
/************************************************************************* | ||
* set the size of editor | ||
*/ | ||
TinyMCENativeEngine.prototype.setSize = function(width, height) { | ||
var self = this, | ||
elem = self.getWrapperElement(); | ||
|
||
width = width || 'auto'; | ||
height = height || 'auto'; | ||
|
||
if (elem) { | ||
elem.height(height); | ||
} | ||
}; | ||
|
||
/*************************************************************************** | ||
* editor defaults | ||
*/ | ||
TinyMCENativeEngine.defaults = { | ||
debug: true, | ||
natedit: { | ||
} | ||
}; | ||
|
||
/************************************************************************* | ||
* register engine to NatEditor shell | ||
*/ | ||
$.NatEditor.engines.tinymce_native = { | ||
createEngine: function(shell) { | ||
return (new TinyMCENativeEngine(shell)).init(); | ||
} | ||
}; | ||
|
||
})(jQuery); |
Oops, something went wrong.