Browse files

Merge pull request #95 from simonwelsh/silverstripe-cms

---

ssmacron had a reference to sapphire. Rather than trying to figure out how to make it variable, moving the plugin into third party means the path doesnt need it. ssbuttons is also moved and now all the tinyMCE related JS is in sapphire.

See also silverstripe/silverstripe-framework#310

Conflicts:
	javascript/tinymce_ssbuttons/editor_plugin_src.js
  • Loading branch information...
2 parents 75dcc5b + 517bf31 commit dcdb0b4731ab8f0386b7ca8f0aedc951e08a50dd @chillu chillu committed Apr 16, 2012
View
52 javascript/tinymce_ssbuttons/editor_plugin_src.js
@@ -1,52 +0,0 @@
-(function() {
-
- // TinyMCE will stop loading if it encounters non-existent external script file
- // when included through tiny_mce_gzip.php. Only load the external lang package if it is available.
- var availableLangs = ['en', 'de'];
- if(jQuery.inArray(tinymce.settings.language, availableLangs) != -1) {
- tinymce.PluginManager.requireLangPack("ssbuttons");
- }
-
- var each = tinymce.each;
-
- tinymce.create('tinymce.plugins.SSButtons', {
- /**
- * Returns information about the plugin as a name/value array.
- * The current keys are longname, author, authorurl, infourl and version.
- *
- * @returns Name/value array containing information about the plugin.
- * @type Array
- */
- getInfo : function() {
- return {
- longname : 'Special buttons for SilverStripe CMS',
- author : 'Sam Minnée',
- authorurl : 'http://www.siverstripe.com/',
- infourl : 'http://www.silverstripe.com/',
- version : "1.0"
- };
- },
-
- init : function(ed, url) {
- ed.addButton('sslink', {title : ed.getLang('tinymce_ssbuttons.insertlink'), cmd : 'sslink', 'class' : 'mce_link'});
- ed.addButton('ssimage', {title : ed.getLang('tinymce_ssbuttons.insertimage'), cmd : 'ssimage', 'class' : 'mce_image'});
-
- ed.addCommand("sslink", function(ed) {
- jQuery('#' + this.id).entwine('ss').openLinkDialog();
- });
-
- ed.addCommand("ssimage", function(ed) {
- jQuery('#' + this.id).entwine('ss').openMediaDialog();
- });
-
- // Disable link button when no link is selected
- ed.onNodeChange.add(function(ed, cm, n, co) {
- cm.setDisabled('sslink', co && n.nodeName != 'A');
- cm.setActive('sslink', n.nodeName == 'A' && !n.name);
- });
- }
- });
-
- // Adds the plugin class to the list of available TinyMCE plugins
- tinymce.PluginManager.add("ssbuttons", tinymce.plugins.SSButtons);
-})();
View
BIN javascript/tinymce_ssbuttons/img/flash.gif
Deleted file not rendered
View
5 javascript/tinymce_ssbuttons/langs/de.js
@@ -1,5 +0,0 @@
-tinyMCE.addI18n('de.tinymce_ssbuttons',{
-insertlink: 'Link einfügen',
-insertimage: 'Bild einfügen',
-insertflash: 'Flash Objekt einfügen'
-});
View
5 javascript/tinymce_ssbuttons/langs/en.js
@@ -1,5 +0,0 @@
-tinyMCE.addI18n('en.tinymce_ssbuttons', {
-insertlink: 'Insert Link',
-insertimage: 'Insert Image',
-insertflash: 'Insert Flash Object'
-});
View
46 javascript/tinymce_ssmacron/editor_plugin_src.js
@@ -1,46 +0,0 @@
-(function() {
- var each = tinymce.each;
-
- /**
- * Load via:
- * HtmlEditorConfig::get('cms')->enablePlugins(array('ssmacron', '../../../../cms/javascript/tinymce_ssmacron'))
- * HtmlEditorConfig::get('cms')->insertButtonsAfter ('advcode', 'ssmacron');
- */
- tinymce.create('tinymce.plugins.InsertMacron', {
- getInfo : function() {
- return {
- longname : 'Button to insert macrons',
- author : 'Hamish Friedlander. Heavily based on charmap that comes with TinyMCE',
- authorurl : 'http://www.siverstripe.com/',
- infourl : 'http://www.silverstripe.com/',
- version : "1.0"
- };
- },
-
-
- init : function(ed, url) {
- // Register commands
- ed.addCommand('mceInsertMacron', function() {
- ed.windowManager.open({
- file : url + '/macron.htm',
- width : 350 + parseInt(ed.getLang('advanced.charmap_delta_width', 0)),
- height : 150 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)),
- inline : true
- }, {
- plugin_url : url
- });
- });
-
- // Register buttons
- ed.addButton('ssmacron', {
- title : 'Insert a Macron',
- cmd : 'mceInsertMacron',
- image : url + '/img/macron.png'
- });
-
- }
- });
-
- // Adds the plugin class to the list of available TinyMCE plugins
- tinymce.PluginManager.add("ssmacron", tinymce.plugins.InsertMacron);
-})();
View
BIN javascript/tinymce_ssmacron/img/macron.png
Deleted file not rendered
View
71 javascript/tinymce_ssmacron/js/macron.js
@@ -1,71 +0,0 @@
-tinyMCEPopup.requireLangPack();
-
-var charmap = [
- ['Ā', 'Ā', true, 'A - macron'],
- ['Ē', 'Ē', true, 'E - macron'],
- ['Ī', 'Ī', true, 'I - macron'],
- ['Ō', 'Ō', true, 'O - macron'],
- ['Ū', 'Ū', true, 'U - macron'],
- ['ā', 'ā', true, 'a - macron'],
- ['ē', 'ē', true, 'e - macron'],
- ['ī', 'ī', true, 'i - macron'],
- ['ō', 'ō', true, 'o - macron'],
- ['ū', 'ū', true, 'u - macron']
-];
-
-tinyMCEPopup.onInit.add(function() {
- tinyMCEPopup.dom.setHTML('charmapView', renderCharMapHTML());
-});
-
-function renderCharMapHTML() {
- var charsPerRow = 5, tdWidth=20, tdHeight=20, i;
- var html = '<table border="0" cellspacing="1" cellpadding="0" width="' + (tdWidth*charsPerRow) + '"><tr height="' + tdHeight + '">';
- var cols=-1;
-
- for (i=0; i<charmap.length; i++) {
- if (charmap[i][2]==true) {
- cols++;
- html += ''
- + '<td class="charmap">'
- + '<a onmouseover="previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');" onfocus="previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');" href="javascript:void(0)" onclick="insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');" onclick="return false;" onmousedown="return false;" title="' + charmap[i][3] + '">'
- + charmap[i][1]
- + '</a></td>';
- if ((cols+1) % charsPerRow == 0)
- html += '</tr><tr height="' + tdHeight + '">';
- }
- }
-
- if (cols % charsPerRow > 0) {
- var padd = charsPerRow - (cols % charsPerRow);
- for (var i=0; i<padd-1; i++)
- html += '<td width="' + tdWidth + '" height="' + tdHeight + '" class="charmap">&nbsp;</td>';
- }
-
- html += '</tr></table>';
-
- return html;
-}
-
-function insertChar(chr) {
- tinyMCEPopup.execCommand('mceInsertContent', false, '&#' + chr + ';');
-
- // Refocus in window
- if (tinyMCEPopup.isWindow)
- window.focus();
-
- tinyMCEPopup.editor.focus();
- tinyMCEPopup.close();
-}
-
-function previewChar(codeA, codeB, codeN) {
- var elmV = document.getElementById('codeV');
- var elmN = document.getElementById('codeN');
-
- if (codeA=='#160;') {
- elmV.innerHTML = '__';
- } else {
- elmV.innerHTML = '&' + codeA;
- }
-
- elmN.innerHTML = codeN;
-}
View
31 javascript/tinymce_ssmacron/macron.htm
@@ -1,31 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
- <title>Insert a Macron</title>
- <script type="text/javascript" src="../../../sapphire/thirdparty/tinymce/tiny_mce_popup.js"></script>
- <script type="text/javascript" src="js/macron.js"></script>
-</head>
-<body id="charmap" style="display:none">
-<table align="center" border="0" cellspacing="0" cellpadding="2">
- <tr>
- <td colspan="2" class="title">Insert a Macron</td>
- </tr>
- <tr>
- <td id="charmapView" align="left" valign="top">
- <!-- Chars will be rendered here -->
- </td>
- <td width="100" align="center" valign="top">
- <table border="0" cellpadding="0" cellspacing="0" width="100" style="height:100px">
- <tr>
- <td id="codeV">&nbsp;</td>
- </tr>
- <tr>
- <td id="codeN">&nbsp;</td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-</body>
-</html>

0 comments on commit dcdb0b4

Please sign in to comment.