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 = {};
......@@ -139,6 +136,7 @@ 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;
......@@ -176,6 +174,7 @@ 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;
......@@ -219,6 +218,25 @@ 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;
......@@ -256,7 +274,7 @@ 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',
......@@ -269,6 +287,7 @@ 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,10 +304,8 @@ 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({
file: url + '/event-monthwidget.html',
......@@ -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,7 +359,6 @@ 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'});
......@@ -353,9 +367,7 @@ Unl.hasParentNodeWithClass = function(childNode, parentClass) {
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;
......@@ -367,19 +379,15 @@ 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'});
});
// Return the new splitbutton instance
return c;
......@@ -391,10 +399,8 @@ 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'});
......@@ -402,17 +408,17 @@ Unl.hasParentNodeWithClass = function(childNode, parentClass) {
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