Fix wysiwyg form container for prefixed forms
authorMatthias Schmidt <gravatronics@live.com>
Sun, 29 Sep 2019 13:51:39 +0000 (15:51 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 29 Sep 2019 13:51:39 +0000 (15:51 +0200)
com.woltlab.wcf/templates/__pollOptionsFormField.tpl
com.woltlab.wcf/templates/__wysiwygAttachmentFormField.tpl
com.woltlab.wcf/templates/__wysiwygPreviewFormButton.tpl
com.woltlab.wcf/templates/__wysiwygSmileyFormContainer.tpl
wcfsetup/install/files/acp/templates/__pollOptionsFormField.tpl
wcfsetup/install/files/acp/templates/__wysiwygPreviewFormButton.tpl
wcfsetup/install/files/acp/templates/__wysiwygSmileyFormContainer.tpl
wcfsetup/install/files/lib/system/form/builder/TWysiwygFormNode.class.php

index c2ea0a9edb2546bb251f0c3b3eee48ff701528cb..b582ffde8947fef8564966842ef72599b939dcf1 100644 (file)
@@ -16,7 +16,7 @@
                new UiPollEditor(
                        DomUtil.identify(DomTraverse.childByTag(elById('{@$field->getPrefixedId()}Container'), 'DD')),
                        [ {implode from=$field->getValue() item=pollOption}{ optionID: {@$pollOption[optionID]}, optionValue: '{$pollOption[optionValue]|encodeJS}' }{/implode} ],
-                       '{@$field->getWysiwygId()}',
+                       '{@$field->getPrefixedWysiwygId()}',
                        {
                                isAjax: {if $field->getDocument()->isAjax()}true{else}false{/if},
                                maxOptions: {@POLL_MAX_OPTIONS}
index 4a12ce6d371fb0d862badc8adee2be6e777fb364..6517d07e96e2c4e15e41594f1612fd5367215bb6 100644 (file)
@@ -66,7 +66,7 @@
                        '{$field->getAttachmentHandler()->getTmpHashes()[0]|encodeJS}',
                        '{@$field->getAttachmentHandler()->getParentObjectID()}',
                        {@$field->getAttachmentHandler()->getMaxCount()},
-                       '{@$field->getWysiwygId()}'
+                       '{@$field->getPrefixedWysiwygId()}'
                );
                new WCF.Action.Delete('wcf\\data\\attachment\\AttachmentAction', '.formAttachmentList > li');
        });
index ffdcb291faa01be51e5472443465250b67a1bfa7..6501f1538e653fa352041977842197e1fead799b 100644 (file)
@@ -11,7 +11,7 @@
                });
                
                new WCF.Message.DefaultPreview({
-                       messageFieldID: '{@$button->getWysiwygId()}',
+                       messageFieldID: '{@$button->getPrefixedWysiwygId()}',
                        previewButtonID: '{@$button->getPrefixedId()}',
                        messageObjectType: '{@$button->getObjectType()->objectType}',
                        messageObjectID: '{@$button->getObjectId()}'
index 6f572aa277e8173a5c92680a27b7124acf351d35..4a6df1a9eec36f20ec36a66af0d516ecf480591a 100644 (file)
@@ -3,9 +3,11 @@
 <script data-relocate="true">
        $(function() {
                {if $container->children()|count > 1}
-                       new WCF.Message.SmileyCategories('{@$container->getWysiwygId()}');
+                       new WCF.Message.SmileyCategories('{@$container->getPrefixedWysiwygId()}');
                {/if}
                
-               new WCF.Message.Smilies('{@$container->getWysiwygId()}');
+               require(['WoltLabSuite/Core/Ui/Smiley/Insert'], function(UiSmileyInsert) {
+                       new UiSmileyInsert('{@$container->getPrefixedWysiwygId()}');
+               });
        });
 </script>
index c2ea0a9edb2546bb251f0c3b3eee48ff701528cb..b582ffde8947fef8564966842ef72599b939dcf1 100644 (file)
@@ -16,7 +16,7 @@
                new UiPollEditor(
                        DomUtil.identify(DomTraverse.childByTag(elById('{@$field->getPrefixedId()}Container'), 'DD')),
                        [ {implode from=$field->getValue() item=pollOption}{ optionID: {@$pollOption[optionID]}, optionValue: '{$pollOption[optionValue]|encodeJS}' }{/implode} ],
-                       '{@$field->getWysiwygId()}',
+                       '{@$field->getPrefixedWysiwygId()}',
                        {
                                isAjax: {if $field->getDocument()->isAjax()}true{else}false{/if},
                                maxOptions: {@POLL_MAX_OPTIONS}
index ffdcb291faa01be51e5472443465250b67a1bfa7..6501f1538e653fa352041977842197e1fead799b 100644 (file)
@@ -11,7 +11,7 @@
                });
                
                new WCF.Message.DefaultPreview({
-                       messageFieldID: '{@$button->getWysiwygId()}',
+                       messageFieldID: '{@$button->getPrefixedWysiwygId()}',
                        previewButtonID: '{@$button->getPrefixedId()}',
                        messageObjectType: '{@$button->getObjectType()->objectType}',
                        messageObjectID: '{@$button->getObjectId()}'
index 6f572aa277e8173a5c92680a27b7124acf351d35..4a6df1a9eec36f20ec36a66af0d516ecf480591a 100644 (file)
@@ -3,9 +3,11 @@
 <script data-relocate="true">
        $(function() {
                {if $container->children()|count > 1}
-                       new WCF.Message.SmileyCategories('{@$container->getWysiwygId()}');
+                       new WCF.Message.SmileyCategories('{@$container->getPrefixedWysiwygId()}');
                {/if}
                
-               new WCF.Message.Smilies('{@$container->getWysiwygId()}');
+               require(['WoltLabSuite/Core/Ui/Smiley/Insert'], function(UiSmileyInsert) {
+                       new UiSmileyInsert('{@$container->getPrefixedWysiwygId()}');
+               });
        });
 </script>
index a0f4a85da2d7ab61d5e24525177fb86a6fefe8b7..24bfff16fb6f4d6ecca5bc8cad6ce4b9487d36ea 100644 (file)
@@ -18,6 +18,16 @@ trait TWysiwygFormNode {
         */
        protected $wysiwygId;
        
+       /**
+        * Returns the prefixed id of the related `WysiwygFormField` form field.
+        * 
+        * @return      string
+        * @throws      \BadMethodCallException         if the id of the related `WysiwygFormField` form field is unknown
+        */
+       public function getPrefixedWysiwygId() {
+               return $this->getDocument()->getPrefix() . $this->getWysiwygId();
+       }
+       
        /**
         * Returns id of the related `WysiwygFormField` form field.
         *