@@ -22,9 +22,9 @@
|
||||
return;
|
||||
|
||||
ed.windowManager.open({
|
||||
file : url + '/link.htm',
|
||||
file: tinyMCE.activeEditor.getParam('umbraco_path') + '/plugins/tinymce3/insertLink.aspx',
|
||||
width : 480 + parseInt(ed.getLang('advlink.delta_width', 0)),
|
||||
height : 400 + parseInt(ed.getLang('advlink.delta_height', 0)),
|
||||
height : 510 + parseInt(ed.getLang('advlink.delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url
|
||||
|
||||
@@ -27,12 +27,13 @@ function init() {
|
||||
var elm = inst.selection.getNode();
|
||||
var action = "insert";
|
||||
var html;
|
||||
document.getElementById('anchorlistcontainer').innerHTML = getAnchorListHTML('anchorlist', 'href');
|
||||
document.getElementById('targetlistcontainer').innerHTML = getTargetListHTML('targetlist', 'target');
|
||||
|
||||
/*
|
||||
document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','advlink');
|
||||
document.getElementById('popupurlbrowsercontainer').innerHTML = getBrowserHTML('popupurlbrowser','popupurl','file','advlink');
|
||||
document.getElementById('linklisthrefcontainer').innerHTML = getLinkListHTML('linklisthref','href');
|
||||
document.getElementById('anchorlistcontainer').innerHTML = getAnchorListHTML('anchorlist','href');
|
||||
document.getElementById('targetlistcontainer').innerHTML = getTargetListHTML('targetlist','target');
|
||||
|
||||
// Link list
|
||||
html = getLinkListHTML('linklisthref','href');
|
||||
@@ -48,18 +49,31 @@ function init() {
|
||||
if (isVisible('popupurlbrowser'))
|
||||
document.getElementById('popupurl').style.width = '180px';
|
||||
|
||||
elm = inst.dom.getParent(elm, "A");
|
||||
if (elm != null && elm.nodeName == "A")
|
||||
action = "update";
|
||||
|
||||
formObj.insert.value = tinyMCEPopup.getLang(action, 'Insert', true);
|
||||
|
||||
setPopupControlsDisabled(true);
|
||||
*/
|
||||
|
||||
elm = inst.dom.getParent(elm, "A");
|
||||
if (elm != null && elm.nodeName == "A")
|
||||
action = "update";
|
||||
|
||||
formObj.insert.value = tinyMCEPopup.getLang(action, 'Insert', true);
|
||||
|
||||
if (action == "update") {
|
||||
var href = inst.dom.getAttrib(elm, 'href');
|
||||
var onclick = inst.dom.getAttrib(elm, 'onclick');
|
||||
// umbraco specific, check local links
|
||||
var href = validateUmbracoLink(inst.dom.getAttrib(elm, 'href'));
|
||||
var onclick = inst.dom.getAttrib(elm, 'onclick');
|
||||
|
||||
// Setup form data
|
||||
setFormValue('href', href);
|
||||
setFormValue('title', inst.dom.getAttrib(elm, 'title'));
|
||||
//setFormValue('target', inst.dom.getAttrib(elm, 'target'));
|
||||
|
||||
if (href.charAt(0) == '#')
|
||||
selectByValue(formObj, 'anchorlist', href);
|
||||
|
||||
selectByValue(formObj, 'targetlist', inst.dom.getAttrib(elm, 'target'), true);
|
||||
/*
|
||||
// Setup form data
|
||||
setFormValue('href', href);
|
||||
setFormValue('title', inst.dom.getAttrib(elm, 'title'));
|
||||
@@ -108,13 +122,15 @@ function init() {
|
||||
|
||||
selectByValue(formObj, 'classlist', inst.dom.getAttrib(elm, 'class'), true);
|
||||
selectByValue(formObj, 'targetlist', inst.dom.getAttrib(elm, 'target'), true);
|
||||
} else
|
||||
addClassesToList('classlist', 'advlink_styles');
|
||||
*/
|
||||
}
|
||||
// else
|
||||
// addClassesToList('classlist', 'advlink_styles');
|
||||
}
|
||||
|
||||
function checkPrefix(n) {
|
||||
if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_email')))
|
||||
n.value = 'mailto:' + n.value;
|
||||
// if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_email')))
|
||||
// n.value = 'mailto:' + n.value;
|
||||
|
||||
if (/^\s*www\./i.test(n.value) && confirm(tinyMCEPopup.getLang('advlink_dlg.is_external')))
|
||||
n.value = 'http://' + n.value;
|
||||
@@ -382,6 +398,11 @@ function insertAction() {
|
||||
var inst = tinyMCEPopup.editor;
|
||||
var elm, elementArray, i;
|
||||
|
||||
// umbraco specific - if there's a locallink, we'll grap that
|
||||
if (document.forms[0].localUrl.value) {
|
||||
document.forms[0].href.value = document.forms[0].localUrl.value;
|
||||
}
|
||||
|
||||
elm = inst.selection.getNode();
|
||||
checkPrefix(document.forms[0].href);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
(function () {
|
||||
// Load plugin specific language pack
|
||||
tinymce.PluginManager.requireLangPack('umbraco');
|
||||
|
||||
@@ -18,18 +18,18 @@
|
||||
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
||||
* @param {string} url Absolute URL to where the plugin is located.
|
||||
*/
|
||||
init: function(ed, url) {
|
||||
init: function (ed, url) {
|
||||
|
||||
this.editor = ed;
|
||||
|
||||
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
||||
ed.addCommand('mceumbracosetstyle', function() {
|
||||
ed.addCommand('mceumbracosetstyle', function () {
|
||||
alert('blah');
|
||||
});
|
||||
|
||||
|
||||
// Add a node change handler, selects the button in the UI when a image is selected
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
ed.onNodeChange.add(function (ed, cm, n) {
|
||||
var c = cm.get('umbracostyles');
|
||||
var formatSelected = false;
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
if (c = cm.get('formatselect')) {
|
||||
p = DOM.getParent(n, DOM.isBlock);
|
||||
|
||||
if (p)
|
||||
if (p)
|
||||
c.select(p.nodeName.toLowerCase());
|
||||
}
|
||||
*/
|
||||
@@ -83,7 +83,7 @@
|
||||
* @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
|
||||
* @return {tinymce.ui.Control} New control instance or null if no control was created.
|
||||
*/
|
||||
createControl: function(n, cm) {
|
||||
createControl: function (n, cm) {
|
||||
|
||||
// add style dropdown
|
||||
if (n == 'umbracocss') {
|
||||
@@ -92,20 +92,41 @@
|
||||
|
||||
var styles = cm.createListBox('umbracostyles', {
|
||||
title: this.editor.getLang('umbraco.style_select'),
|
||||
onselect: function(v) {
|
||||
onselect: function (v) {
|
||||
if (v == '') {
|
||||
if (styles.selectedValue.indexOf('.') == 0) {
|
||||
// remove style
|
||||
tinyMCE.activeEditor.execCommand('mceSetStyleInfo', 0, { command: 'removeformat' });
|
||||
var styleObj = tinymce.activeEditor.formatter.get('umb' + v.substring(1, v.length));
|
||||
if (styleObj == undefined) {
|
||||
tinymce.activeEditor.formatter.register('umb' + v.substring(1, v.length), {
|
||||
inline: 'span',
|
||||
selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img',
|
||||
classes: v.substring(1, v.length)
|
||||
});
|
||||
}
|
||||
tinyMCE.activeEditor.formatter.remove('umb' + v.substring(1, v.length));
|
||||
|
||||
// tinymce.activeEditor.execCommand('mceSetStyleInfo', 0, { command: 'removeformat' });
|
||||
} else {
|
||||
// remove block element
|
||||
tinyMCE.activeEditor.execCommand('FormatBlock', false, 'p');
|
||||
tinymce.activeEditor.execCommand('FormatBlock', false, 'p');
|
||||
}
|
||||
}
|
||||
else if (v.indexOf('.') != '0') {
|
||||
tinyMCE.activeEditor.execCommand('FormatBlock', false, v);
|
||||
tinymce.activeEditor.execCommand('FormatBlock', false, v);
|
||||
} else {
|
||||
tinyMCE.activeEditor.execCommand('mceSetCSSClass', false, v.substring(1, v.length));
|
||||
// use new formatting engine
|
||||
if (tinymce.activeEditor.formatter.get(v.substring(1, v.length)) == undefined) {
|
||||
tinymce.activeEditor.formatter.register('umb' + v.substring(1, v.length), {
|
||||
inline: 'span',
|
||||
selector: 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img',
|
||||
classes: v.substring(1, v.length)
|
||||
});
|
||||
}
|
||||
var styleObj = tinymce.activeEditor.formatter.get('umb' + v.substring(1, v.length));
|
||||
tinyMCE.activeEditor.formatter.apply('umb' + v.substring(1, v.length));
|
||||
|
||||
// tinyMCE.activeEditor.execCommand('mceSetCSSClass', false, v.substring(1, v.length));
|
||||
|
||||
}
|
||||
return false;
|
||||
@@ -120,7 +141,12 @@
|
||||
|
||||
if (alias.indexOf('.') < 0)
|
||||
alias = alias.toLowerCase();
|
||||
|
||||
else if (alias.length > 1) {
|
||||
// register with new formatter engine (can't access from here so a hack in the set style above!)
|
||||
// tinyMCE.activeEditor.formatter.register('umb' + alias.substring(1, alias.length), {
|
||||
// classes: alias.substring(1, alias.length)
|
||||
// });
|
||||
}
|
||||
styles.add(name, alias);
|
||||
}
|
||||
}
|
||||
@@ -132,13 +158,14 @@
|
||||
return null;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Returns information about the plugin as a name/value array.
|
||||
* The current keys are longname, author, authorurl, infourl and version.
|
||||
*
|
||||
* @return {Object} Name/value array containing information about the plugin.
|
||||
*/
|
||||
getInfo: function() {
|
||||
getInfo: function () {
|
||||
return {
|
||||
longname: 'Umbraco CSS/Styling Plugin',
|
||||
author: 'Umbraco',
|
||||
|
||||
@@ -32,3 +32,5 @@ Image:
|
||||
file: tinyMCE.activeEditor.getParam('umbraco_path') + '/plugins/tinymce3/insertImage.aspx',
|
||||
width: 575 + parseInt(ed.getLang('advimage.delta_width', 0)),
|
||||
height: 585 + parseInt(ed.getLang('advimage.delta_height', 0)),
|
||||
|
||||
5. Update the advlink.js to make sure that it doesn't check for the loads of tabs in the traditional tiny link dialog (check old version)
|
||||
Reference in New Issue
Block a user