Fixed clicks on smilies triggering inserts on all active instances
authorAlexander Ebert <ebert@woltlab.com>
Wed, 27 Aug 2014 16:26:57 +0000 (18:26 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 27 Aug 2014 16:26:57 +0000 (18:26 +0200)
com.woltlab.wcf/templates/messageFormTabs.tpl
com.woltlab.wcf/templates/messageFormTabsInline.tpl
wcfsetup/install/files/js/WCF.Message.js

index c77c8ff76766c6713c69dc6ed1bb1c8f354bdbb3..13e6964cbc8bb63b76e85c192283a977c6241205 100644 (file)
@@ -1,4 +1,4 @@
-<div class="messageTabMenu" data-preselect="{if $preselectTabMenu|isset}{$preselectTabMenu}{else}true{/if}">
+<div class="messageTabMenu" data-preselect="{if $preselectTabMenu|isset}{$preselectTabMenu}{else}true{/if}" data-wysiwyg-container-id="{$wysiwygContainerID}">
        <nav class="messageTabMenuNavigation jsOnly">
                <ul>
                        {if MODULE_SMILEY && $__wcf->getSession()->getPermission($permissionCanUseSmilies) && $smileyCategories|count}<li data-name="smilies"><a>{lang}wcf.message.smilies{/lang}</a></li>{/if}
index 0b25d9ef30a9f9e498f15629a3775cb135876e3b..2e6e365247bb465703f22926c7e5af3e6d306b5b 100644 (file)
@@ -5,7 +5,7 @@
 {capture assign='__messageFormSettingsInlineContent'}{include file='messageFormSettingsInline'}{/capture}
 {assign var='__messageFormSettingsInlineContent' value=$__messageFormSettingsInlineContent|trim}
 
-<div class="messageTabMenu"{if $preselectTabMenu|isset} data-preselect="{$preselectTabMenu}"{/if}>
+<div class="messageTabMenu"{if $preselectTabMenu|isset} data-preselect="{$preselectTabMenu}"{/if} data-wysiwyg-container-id="{$wysiwygContainerID}">
        <nav class="messageTabMenuNavigation jsOnly">
                <ul>
                        {if MODULE_SMILEY && $__wcf->getSession()->getPermission($permissionCanUseSmilies) && $smileyCategories|count}<li data-name="smilies"><a>{lang}wcf.message.smilies{/lang}</a></li>{/if}
index cf930528bd7a6e7915d17f21d8a53ca4d8d691f8..e109d281e668b9d7e987505e3c4e7828e7ec3954 100644 (file)
@@ -622,14 +622,6 @@ WCF.Message.SmileyCategories = Class.extend({
                this._wysiwygSelector = wysiwygSelector;
                
                $('#smilies-' + this._wysiwygSelector).on('messagetabmenushow', $.proxy(this._click, this));
-               
-               // handle onload
-               /*var self = this;
-               new WCF.PeriodicalExecuter(function(pe) {
-                       pe.stop();
-                       
-                       self._click({ }, { newTab: $('#smilies > .menu li.ui-state-active') });
-               }, 100);*/
        },
        
        /**
@@ -682,6 +674,8 @@ WCF.Message.SmileyCategories = Class.extend({
 
 /**
  * Handles smiley clicks.
+ * 
+ * @param      string          wysiwygSelector
  */
 WCF.Message.Smilies = Class.extend({
        /**
@@ -690,6 +684,10 @@ WCF.Message.Smilies = Class.extend({
         */
        _redactor: null,
        
+       /**
+        * wysiwyg container id
+        * @var string
+        */
        _wysiwygSelector: '',
        
        /**
@@ -703,8 +701,7 @@ WCF.Message.Smilies = Class.extend({
                WCF.System.Dependency.Manager.register('Redactor_' + this._wysiwygSelector, $.proxy(function() {
                        this._redactor = $('#' + this._wysiwygSelector).redactor('getObject');
                        
-                       // add smiley click handler
-                       $(document).on('click', '.jsSmiley', $.proxy(this._smileyClick, this));
+                       $('.messageTabMenu[data-wysiwyg-container-id=' + this._wysiwygSelector + ']').on('click', '.jsSmiley', $.proxy(this._smileyClick, this));
                }, this));
        },