Fixed bug #15203: htmlArea RTE: Modify link option missing in context menu
authorStanislas Rolland <typo3@sjbr.ca>
Fri, 23 Jul 2010 15:52:18 +0000 (15:52 +0000)
committerStanislas Rolland <typo3@sjbr.ca>
Fri, 23 Jul 2010 15:52:18 +0000 (15:52 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@8252 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/rtehtmlarea/ChangeLog
typo3/sysext/rtehtmlarea/htmlarea/htmlarea.js
typo3/sysext/rtehtmlarea/htmlarea/locallang_dialogs.xml
typo3/sysext/rtehtmlarea/htmlarea/plugins/ContextMenu/context-menu.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultImage/default-image.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/DefaultLink/default-link.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Image/typo3image.js
typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Link/typo3link.js

index 295f2ec..30dd2ed 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-07-23  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed bug #15203: htmlArea RTE: Modify link option missing in context menu
+
 2010-07-21  Xavier Perseguers  <typo3@perseguers.ch>
 
        * Added feature #15192: Add hook to postprocess filelist operations
index 829119c..fb5a0f7 100644 (file)
@@ -1,3 +1,7 @@
+2010-07-23  Stanislas Rolland  <typo3@sjbr.ca>
+
+       * Fixed bug #15203: htmlArea RTE: Modify link option missing in context menu
+
 2010-07-10  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Fixed bug #14896: ExtJS is not included when RTE is invoked by USER_INT frontend script
index 5b86ad7..a9ff793 100644 (file)
@@ -4442,7 +4442,7 @@ HTMLArea.Plugin = HTMLArea.Base.extend({
        openContainerWindow: function (buttonId, title, dimensions, url) {
                this.dialog = new Ext.Window({
                        id: this.editor.editorId + buttonId,
-                       title: this.localize(title),
+                       title: this.localize(title) || title,
                        cls: 'htmlarea-window',
                        width: dimensions.width,
                        height: dimensions.height,
index 00d520d..3465134 100644 (file)
@@ -36,6 +36,8 @@
                        <label index="Border thickness:">Border thickness:</label>
                        <label index="Leave empty for no border">Leave empty for no border</label>
                        <label index="Insert/Modify Link">Insert/Modify Link</label>
+                       <label index="Insert link">Insert link</label>
+                       <label index="Modify link">Modify link</label>
                        <label index="URL:">URL:</label>
                        <label index="link_href_tooltip">Enter the link URL here</label>
                        <label index="link_url_required">Please enter the URL where this link points to</label>
@@ -70,6 +72,8 @@
                        <label index="Cell padding:">Cell padding:</label>
                        <label index="Space between content and border in cell">Space between content and border in cell</label>
                        <label index="Insert Image">Insert/Modify Image</label>
+                       <label index="Insert image">Insert image</label>
+                       <label index="Modify image">Modify image</label>
                        <label index="Image URL:">Image URL:</label>
                        <label index="Enter the image URL here">Enter the image URL here</label>
                        <label index="Preview">Preview</label>
index c56bd5e..3f2a86c 100644 (file)
@@ -54,7 +54,7 @@ HTMLArea.ContextMenu = HTMLArea.Plugin.extend({
                 * Registering plugin "About" information
                 */
                var pluginInformation = {
-                       version         : '3.0',
+                       version         : '3.1',
                        developer       : 'Mihai Bazon & Stanislas Rolland',
                        developerUrl    : 'http://www.sjbr.ca/',
                        copyrightOwner  : 'dynarch.com & Stanislas Rolland',
@@ -201,6 +201,7 @@ HTMLArea.ContextMenu = HTMLArea.Plugin.extend({
                        } else if (xtype === 'menuitem') {
                                var button = this.getButton(menuItem.getItemId());
                                if (button) {
+                                       menuItem.setText(button.tooltip.title);
                                        menuItem.setVisible(!button.disabled);
                                        lastIsButton = lastIsButton || !button.disabled;
                                } else {
index 5f956d8..a664d03 100644 (file)
@@ -68,7 +68,7 @@ HTMLArea.DefaultImage = HTMLArea.Plugin.extend({
                 * Registering plugin "About" information
                 */
                var pluginInformation = {
-                       version         : '2.0',
+                       version         : '2.1',
                        developer       : 'Stanislas Rolland',
                        developerUrl    : 'http://www.sjbr.ca/',
                        copyrightOwner  : 'Stanislas Rolland',
@@ -156,7 +156,7 @@ HTMLArea.DefaultImage = HTMLArea.Plugin.extend({
                        // Open dialogue window
                this.openDialogue(
                        buttonId,
-                       'Insert Image',
+                       this.getButton(buttonId).tooltip.title,
                        this.getWindowDimensions(
                                {
                                        width: 460,
@@ -180,7 +180,7 @@ HTMLArea.DefaultImage = HTMLArea.Plugin.extend({
         */
        openDialogue: function (buttonId, title, dimensions, tabItems) {
                this.dialog = new Ext.Window({
-                       title: this.localize(title),
+                       title: this.localize(title) || title,
                        cls: 'htmlarea-window',
                        border: false,
                        width: dimensions.width,
@@ -504,5 +504,21 @@ HTMLArea.DefaultImage = HTMLArea.Plugin.extend({
                                }
                        });
                }
+       },
+       /*
+        * This function gets called when the toolbar is updated
+        */
+       onUpdateToolbar: function (button, mode, selectionEmpty, ancestors) {
+               if (mode === 'wysiwyg' && this.editor.isEditable() && button.itemId === 'InsertImage' && !button.disabled) {
+                       var image = this.editor.getParentElement();
+                       if (image && !/^img$/i.test(image.nodeName)) {
+                               image = null;
+                       }
+                       if (image) {
+                               button.setTooltip({ title: this.localize('Modify image') });
+                       } else {
+                               button.setTooltip({ title: this.localize('Insert image') });
+                       }
+               }
        }
 });
index 89b8ad5..f040cdc 100644 (file)
@@ -47,7 +47,7 @@ HTMLArea.DefaultLink = HTMLArea.Plugin.extend({
                 * Registering plugin "About" information
                 */
                var pluginInformation = {
-                       version         : '2.0',
+                       version         : '2.1',
                        developer       : 'Stanislas Rolland',
                        developerUrl    : 'http://www.sjbr.ca/',
                        copyrightOwner  : 'Stanislas Rolland',
@@ -149,7 +149,7 @@ HTMLArea.DefaultLink = HTMLArea.Plugin.extend({
                                        // Open dialogue window
                                this.openDialogue(
                                        buttonId,
-                                       'Insert/Modify Link',
+                                       this.getButton(buttonId).tooltip.title,
                                        this.getWindowDimensions(
                                                {
                                                        width: 470,
@@ -173,7 +173,7 @@ HTMLArea.DefaultLink = HTMLArea.Plugin.extend({
         */
        openDialogue: function (buttonId, title, dimensions) {
                this.dialog = new Ext.Window({
-                       title: this.localize(title),
+                       title: this.localize(title) || title,
                        cls: 'htmlarea-window',
                        border: false,
                        width: dimensions.width,
@@ -383,6 +383,18 @@ HTMLArea.DefaultLink = HTMLArea.Plugin.extend({
        onUpdateToolbar: function (button, mode, selectionEmpty, ancestors) {
                if (mode === 'wysiwyg' && this.editor.isEditable() && button.itemId === 'CreateLink') {
                        button.setDisabled(selectionEmpty && !button.isInContext(mode, selectionEmpty, ancestors));
+                       if (!button.disabled) {
+                               var node = this.editor.getParentElement();
+                               var el = HTMLArea.getElementObject(node, 'a');
+                               if (el != null && /^a$/i.test(el.nodeName)) {
+                                       node = el;
+                               }
+                               if (node != null && /^a$/i.test(node.nodeName)) {
+                                       button.setTooltip({ title: this.localize('Modify link') });
+                               } else {
+                                       button.setTooltip({ title: this.localize('Insert link') });
+                               }
+                       }
                }
        }
 });
index 4e2f852..29bd957 100644 (file)
@@ -43,7 +43,7 @@ HTMLArea.TYPO3Image = HTMLArea.Plugin.extend({
                 * Registering plugin "About" information
                 */
                var pluginInformation = {
-                       version         : '2.0',
+                       version         : '2.1',
                        developer       : 'Stanislas Rolland',
                        developerUrl    : 'http://www.sjbr.ca/',
                        copyrightOwner  : 'Stanislas Rolland',
@@ -89,7 +89,7 @@ HTMLArea.TYPO3Image = HTMLArea.Plugin.extend({
                }
                this.openContainerWindow(
                        buttonId,
-                       buttonId + '-Tooltip',
+                       this.getButton(buttonId).tooltip.title,
                        this.getWindowDimensions(
                                {
                                        width:  610,
@@ -120,5 +120,21 @@ HTMLArea.TYPO3Image = HTMLArea.Plugin.extend({
                        this.editor.iframe.onDrop();
                }
                this.close();
+       },
+       /*
+        * This function gets called when the toolbar is updated
+        */
+       onUpdateToolbar: function (button, mode, selectionEmpty, ancestors) {
+               if (mode === 'wysiwyg' && this.editor.isEditable() && button.itemId === 'InsertImage' && !button.disabled) {
+                       var image = this.editor.getParentElement();
+                       if (image && !/^img$/i.test(image.nodeName)) {
+                               image = null;
+                       }
+                       if (image) {
+                               button.setTooltip({ title: this.localize('Modify image') });
+                       } else {
+                               button.setTooltip({ title: this.localize('Insert image') });
+                       }
+               }
        }
 });
index b6e02a5..a243d7e 100644 (file)
@@ -44,7 +44,7 @@ HTMLArea.TYPO3Link = HTMLArea.Plugin.extend({
                 * Registering plugin "About" information
                 */
                var pluginInformation = {
-                       version         : '2.0',
+                       version         : '2.1',
                        developer       : 'Stanislas Rolland',
                        developerUrl    : 'http://www.sjbr.ca/',
                        copyrightOwner  : 'Stanislas Rolland',
@@ -165,7 +165,7 @@ HTMLArea.TYPO3Link = HTMLArea.Plugin.extend({
                        }
                        this.openContainerWindow(
                                buttonId,
-                               buttonId.toLowerCase(),
+                               this.getButton(buttonId).tooltip.title,
                                this.getWindowDimensions(
                                        {
                                                width:  550,
@@ -413,6 +413,18 @@ HTMLArea.TYPO3Link = HTMLArea.Plugin.extend({
        onUpdateToolbar: function (button, mode, selectionEmpty, ancestors) {
                if (mode === 'wysiwyg' && this.editor.isEditable() && button.itemId === 'CreateLink') {
                        button.setDisabled(selectionEmpty && !button.isInContext(mode, selectionEmpty, ancestors));
+                       if (!button.disabled) {
+                               var node = this.editor.getParentElement();
+                               var el = HTMLArea.getElementObject(node, 'a');
+                               if (el != null && /^a$/i.test(el.nodeName)) {
+                                       node = el;
+                               }
+                               if (node != null && /^a$/i.test(node.nodeName)) {
+                                       button.setTooltip({ title: this.localize('Modify link') });
+                               } else {
+                                       button.setTooltip({ title: this.localize('Insert link') });
+                               }
+                       }
                }
        }
 });