Commit 6a3247a5 authored by Eric Rasmussen's avatar Eric Rasmussen
Browse files

[#685] Add placeholder shim divs to Layout menu

parent 9209f9a2
/**
* $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
*
* @author Moxiecode
* @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
* plugins/unl/editor_plugin.js
*/
var Unl = {};
......@@ -43,7 +40,7 @@ Unl.hasParentNodeWithClass = function(childNode, parentClass) {
*/
init : function(ed, url) {
mceUnlBaseUrl = url;
//'div[style]/[*]';
ed.onBeforeSetContent.add(function(ed, o) {
ed.dom.loadCSS("/wdn/templates_3.0/css/all.css");
......@@ -56,11 +53,11 @@ Unl.hasParentNodeWithClass = function(childNode, parentClass) {
for (var i = 0; i < links.length; i++) {
var link = links[i];
var href = link.getAttribute('href');
if (!href) {
continue;
}
// add icons to links via UNL template
if (href.search(/^mailto:/) >= 0 ) {
addClass(link, 'email');
......@@ -130,7 +127,7 @@ Unl.hasParentNodeWithClass = function(childNode, parentClass) {
}
}
});*/
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceUnl');
ed.addCommand('mceUnl', function() {
if (Unl.hasParentNodeWithClass(ed.selection.getNode(), 'zenbox')) {
......@@ -138,7 +135,8 @@ Unl.hasParentNodeWithClass = function(childNode, parentClass) {
}
ed.selection.setContent('<div class="zenbox bright"><h3>Title</h3><p>Body</p></div> <div><img src="http://wdn.unl.edu/graphics/image_templates/image_tag_ex.jpg" class="frame" /><p class="caption">Caption goes here</p></div> <p></p>');
});
// Zenbox
ed.addCommand('mceUnlZenBoxBright', function() {
if (Unl.hasParentNodeWithClass(ed.selection.getNode(), 'zenbox')) {
return;
......@@ -175,7 +173,8 @@ Unl.hasParentNodeWithClass = function(childNode, parentClass) {
}
ed.selection.setContent('<div class="zenbox neutral"><h3>Title</h3><p>Body</p></div>');
});
// UNL Layout
ed.addCommand('mceUnlCol13', function() {
if (Unl.hasParentNodeWithClass(ed.selection.getNode(), 'zenbox')) {
return;
......@@ -218,7 +217,26 @@ Unl.hasParentNodeWithClass = function(childNode, parentClass) {
}
ed.selection.setContent('<div>Placeholder</div><div class="col left"><p>Left Column Placeholder</p></div><div class="col"><p>Middle Column Placeholder</p></div><div class="col"><p>Middle Column Placeholder</p></div><div class="col right"><p>Right Column Placeholder</p></div><br class="clear" /><div>Placeholder</div>');
});
// Placeholder div elements
ed.addCommand('mceUnlPlaceholderAbovePrepend', function() {
var curNode = ed.selection.getNode();
WDN.jQuery(curNode).parent().prepend('<div>Placeholder</div>');
});
ed.addCommand('mceUnlPlaceholderAboveBefore', function() {
var curNode = ed.selection.getNode();
WDN.jQuery(curNode).parent().before('<div>Placeholder</div>');
});
ed.addCommand('mceUnlPlaceholderBelowAppend', function() {
var curNode = ed.selection.getNode();
WDN.jQuery(curNode).parent().append('<div>Placeholder</div>');
});
ed.addCommand('mceUnlPlaceholderBelowAfter', function() {
var curNode = ed.selection.getNode();
WDN.jQuery(curNode).parent().after('<br class="clear" /><div>Placeholder</div>');
});
// ZenTable
ed.addCommand('mceUnlZenTableBright', function() {
if (Unl.hasParentNodeWithClass(ed.selection.getNode(), 'zentable')) {
return;
......@@ -255,8 +273,8 @@ Unl.hasParentNodeWithClass = function(childNode, parentClass) {
}
ed.selection.setContent('<table class="zentable neutral"><thead><tr><th colspan="3">zentable neutral</th></tr></thead><tbody><tr><td>row1 col1</td><td>row1 col2</td><td>row1 col3</td></tr><tr><td>row2 col1</td><td>row2 col2</td><td>row2 col3</td></tr></tbody></table>');
});
// for WDN Tabs
// WDN Tabs
ed.addCommand('mceUnlTabs', function() {
ed.windowManager.open({
file : url + '/tabs.htm',
......@@ -268,7 +286,8 @@ Unl.hasParentNodeWithClass = function(childNode, parentClass) {
});
});
ed.addButton('unlTabs', {title : 'Add Tabs', cmd : 'mceUnlTabs', 'class' : 'unlTabs'});
// WDN Tooltip
ed.addCommand('mceUnlTooltip', function() {
var node = ed.selection.getNode();
if (Unl.hasParentNodeWithClass(node, 'tooltip')) {
......@@ -285,9 +304,7 @@ Unl.hasParentNodeWithClass = function(childNode, parentClass) {
ed.onNodeChange.add(function(ed, cm, n) {
cm.setActive('unlTooltip', Unl.hasParentNodeWithClass(n, 'tooltip'));
});
ed.addButton('unlTooltip', {title : 'Add Tooltip', cmd : 'mceUnlTooltip', 'class' : 'unlTooltip'});
ed.addCommand('mceUnlEventMonthWidget', function() {
ed.windowManager.open({
......@@ -305,8 +322,6 @@ Unl.hasParentNodeWithClass = function(childNode, parentClass) {
});
ed.addButton('unlEventMonthWidget', {title: 'Add Month Widget', cmd : 'mceUnlEventMonthWidget', 'class' : 'unlEventMonthWidget'});
ed.addCommand('mceUnlEventCalendarDisplay', function() {
ed.windowManager.open({
file: url + '/event-calendardisplay.html',
......@@ -344,21 +359,18 @@ Unl.hasParentNodeWithClass = function(childNode, parentClass) {
this.control_manager.get('unlZenBox').showMenu();
}
});
c.onRenderMenu.add(function(c, m) {
m.add({title: 'UNL Zen Box', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
m.add({title: 'Bright (yellow)', cmd: 'mceUnlZenBoxBright'});
m.add({title: 'Cool (blue)', cmd: 'mceUnlZenBoxCool'});
m.add({title: 'Energetic (orange)', cmd: 'mceUnlZenBoxEnergetic'});
m.add({title: 'Soothing (green)', cmd: 'mceUnlZenBoxSoothing'});
m.add({title: 'Primary (red)', cmd: 'mceUnlZenBoxPrimary'});
m.add({title: 'Neutral (gray)', cmd: 'mceUnlZenBoxNeutral'});
m.add({title: 'Cool (blue)', cmd: 'mceUnlZenBoxCool'});
m.add({title: 'Energetic (orange)', cmd: 'mceUnlZenBoxEnergetic'});
m.add({title: 'Soothing (green)', cmd: 'mceUnlZenBoxSoothing'});
m.add({title: 'Primary (red)', cmd: 'mceUnlZenBoxPrimary'});
m.add({title: 'Neutral (gray)', cmd: 'mceUnlZenBoxNeutral'});
});
// Return the new splitbutton instance
return c;
case 'unlZenTable':
var c = cm.createSplitButton('unlZenTable', {
title: 'Add Zen Table',
......@@ -367,22 +379,18 @@ Unl.hasParentNodeWithClass = function(childNode, parentClass) {
this.control_manager.get('unlZenTable').showMenu();
}
});
c.onRenderMenu.add(function(c, m) {
m.add({title: 'UNL Zen Table', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
m.add({title: 'Bright', cmd: 'mceUnlZenTableBright'});
m.add({title: 'Cool', cmd: 'mceUnlZenTableCool'});
m.add({title: 'Energetic', cmd: 'mceUnlZenTableEnergetic'});
m.add({title: 'Soothing', cmd: 'mceUnlZenTableSoothing'});
m.add({title: 'Primary', cmd: 'mceUnlZenTablePrimary'});
m.add({title: 'Neutral', cmd: 'mceUnlZenTableNeutral'});
m.add({title: 'Bright', cmd: 'mceUnlZenTableBright'});
m.add({title: 'Cool', cmd: 'mceUnlZenTableCool'});
m.add({title: 'Energetic', cmd: 'mceUnlZenTableEnergetic'});
m.add({title: 'Soothing', cmd: 'mceUnlZenTableSoothing'});
m.add({title: 'Primary', cmd: 'mceUnlZenTablePrimary'});
m.add({title: 'Neutral', cmd: 'mceUnlZenTableNeutral'});
});
// Return the new splitbutton instance
return c;
case 'unlLayout':
var c = cm.createSplitButton('unlLayout', {
title: 'Add Layout',
......@@ -391,28 +399,26 @@ Unl.hasParentNodeWithClass = function(childNode, parentClass) {
this.control_manager.get('unlLayout').showMenu();
}
});
c.onRenderMenu.add(function(c, m) {
m.add({title: 'UNL Layouts', 'class': 'mceMenuItemTitle'}).setDisabled(1);
m.add({title: 'Two Column (1/3)', cmd: 'mceUnlCol13'});
m.add({title: 'Two Column (2/2)', cmd: 'mceUnlCol22'});
m.add({title: 'Two Column (3/1)', cmd: 'mceUnlCol31'});
m.add({title: 'Three Column (1/1/2)', cmd: 'mceUnlCol112'});
m.add({title: 'Three Column (1/2/1)', cmd: 'mceUnlCol121'});
m.add({title: 'Three Column (2/1/1)', cmd: 'mceUnlCol211'});
m.add({title: 'Four Column (1/1/1/1)', cmd: 'mceUnlCol1111'});
m.add({title: 'Two Column (1/3)', cmd: 'mceUnlCol13'});
m.add({title: 'Two Column (2/2)', cmd: 'mceUnlCol22'});
m.add({title: 'Two Column (3/1)', cmd: 'mceUnlCol31'});
m.add({title: 'Three Column (1/1/2)', cmd: 'mceUnlCol112'});
m.add({title: 'Three Column (1/2/1)', cmd: 'mceUnlCol121'});
m.add({title: 'Three Column (2/1/1)', cmd: 'mceUnlCol211'});
m.add({title: 'Four Column (1/1/1/1)', cmd: 'mceUnlCol1111'});
m.add({title: 'Add Placeholder Above (Prepend)', cmd: 'mceUnlPlaceholderAbovePrepend'});
m.add({title: 'Add Placeholder Above (Before)', cmd: 'mceUnlPlaceholderAboveBefore'});
m.add({title: 'Add Placeholder Below (Append)', cmd: 'mceUnlPlaceholderBelowAppend'});
m.add({title: 'Add Placeholder Below (After)', cmd: 'mceUnlPlaceholderBelowAfter'});
});
// Return the new splitbutton instance
return c;
}
return null;
},
/**
* Returns information about the plugin as a name/value array.
* The current keys are longname, author, authorurl, infourl and version.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment