Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix the overlay button inside the TinyMCE plugin. For some reasons, i…

…n Firefox the button was not easily clickable. Thanks to Olli!

--HG--
extra : convert_revision : svn%3Afc1ba2b4-ac28-11dd-a772-7fcde58d38e6/trunk%40109
  • Loading branch information...
commit 28367d39f312e9e32e1f64c7ec500964495c3a9e 1 parent 6b83d5a
mihai.sucan authored
Showing with 31 additions and 29 deletions.
  1. +5 −0 CHANGES
  2. +26 −29 ext/tinymce-plugin/paintweb/editor_plugin_src.js
View
5 CHANGES
@@ -10,6 +10,11 @@ displayed at the top of PaintWeb, when it runs inside TinyMCE. The background
color is now yellow, and the two Save/Cancel actions use inputs of type=button.
Thanks to Olli Savolainen.
+- The overlay button which shows "Edit" on top of images inside TinyMCE is now
+no longer a link. It is an input of type=button. This change also fixed the
+problem affecting Firefox users: they couldn't easily click the link, for some
+reason. Thanks Olli Savolainen, again!
+
- The TinyMCE plugin now sets up a reference to the current TinyMCE editor
instance in the current PaintWeb.config instance. This allows extensions from
inside PaintWeb to access the TinyMCE editor - using
View
55 ext/tinymce-plugin/paintweb/editor_plugin_src.js
@@ -17,7 +17,7 @@
* along with PaintWeb. If not, see <http://www.gnu.org/licenses/>.
*
* $URL: http://code.google.com/p/paintweb $
- * $Date: 2009-08-12 18:42:12 +0300 $
+ * $Date: 2009-08-12 19:57:50 +0300 $
*/
/**
@@ -187,10 +187,8 @@ function paintwebLoaded () {
*/
function paintwebInitialized (ev) {
if (overlayButton && targetEditor) {
- overlayButton.title = targetEditor.getLang('paintweb.overlayButton',
+ overlayButton.value = targetEditor.getLang('paintweb.overlayButton',
'Edit');
- overlayButton.replaceChild(document.createTextNode(overlayButton.title),
- overlayButton.firstChild);
}
if (ev.state !== PaintWeb.INIT_DONE) {
@@ -326,10 +324,8 @@ function paintwebEditStart () {
var pwStart = function () {
if (overlayButton && overlayButton.parentNode) {
- overlayButton.title = targetEditor.getLang('paintweb.overlayLoading',
+ overlayButton.value = targetEditor.getLang('paintweb.overlayLoading',
'Loading PaintWeb...');
- overlayButton.replaceChild(document.createTextNode(overlayButton.title),
- overlayButton.firstChild);
}
if (paintwebInstance) {
@@ -486,10 +482,8 @@ function paintwebHide () {
paintwebInstance.gui.hide();
if (overlayButton && targetEditor) {
- overlayButton.title = targetEditor.getLang('paintweb.overlayButton',
+ overlayButton.value = targetEditor.getLang('paintweb.overlayButton',
'Edit');
- overlayButton.replaceChild(document.createTextNode(overlayButton.title),
- overlayButton.firstChild);
}
if (pluginBar && pluginBar.parentNode) {
@@ -710,19 +704,12 @@ tinymce.create('tinymce.plugins.paintweb', {
ed.onRemove.add(this.edPreProcess);
ed.onInit.add(overlayButtonCleanup);
- overlayButton = document.createElement('a');
- overlayStyle = overlayButton.style;
-
+ overlayButton = document.createElement('input');
+ overlayButton.type = 'button';
overlayButton.className = 'paintwebOverlayButton';
- overlayButton.title = ed.getLang('paintweb.overlayButton', 'Edit');
- overlayButton.appendChild(document.createTextNode(overlayButton.title));
-
- overlayStyle.position = 'absolute';
- overlayStyle.background = '#fff';
- overlayStyle.padding = '4px 6px';
- overlayStyle.border = '1px solid #000';
- overlayStyle.textDecoration = 'none';
- overlayStyle.color = '#000';
+ overlayButton.value = ed.getLang('paintweb.overlayButton', 'Edit');
+
+ overlayButton.style.position = 'absolute';
}
// Handle the dblclick events for image elements, if the user wants it.
@@ -833,16 +820,26 @@ tinymce.create('tinymce.plugins.paintweb', {
}
if (!disabled) {
+ var offsetTop = 5,
+ offsetLeft = 5,
+ sibling = null;
+
+ // Try to avoid adding the overlay button inside an anchor.
+ if (n.parentNode.nodeName.toLowerCase() === 'a') {
+ pNode = n.parentNode.parentNode;
+ sibling = n.parentNode.nextSibling;
+ } else {
+ pNode = n.parentNode;
+ sibling = n.nextSibling;
+ }
+
// Add the overlay button.
overlayButton._targetImage = n;
- overlayButton.style.top = (n.offsetTop + 5) + 'px';
- overlayButton.style.left = (n.offsetLeft + 5) + 'px';
- overlayButton.title = ed.getLang('paintweb.overlayButton', 'Edit');
- overlayButton.replaceChild(document.createTextNode(overlayButton.title),
- overlayButton.firstChild);
+ overlayButton.style.top = (n.offsetTop + offsetTop) + 'px';
+ overlayButton.style.left = (n.offsetLeft + offsetLeft) + 'px';
+ overlayButton.value = ed.getLang('paintweb.overlayButton', 'Edit');
- pNode = n.parentNode;
- pNode.insertBefore(overlayButton, n.nextSibling);
+ pNode.insertBefore(overlayButton, sibling);
} else if (overlayButton._targetImage) {
overlayButton._targetImage = null;
}
Please sign in to comment.
Something went wrong with that request. Please try again.