1
0
Эх сурвалжийг харах

Ticket #3653 - Posts: Attached poll deletion should remove inlined copies from Text area too.

AntonLV 4 жил өмнө
parent
commit
60df270ae1

+ 2 - 1
modules/base/text/classes/BxBaseModTextTemplate.php

@@ -276,7 +276,8 @@ class BxBaseModTextTemplate extends BxBaseModGeneralTemplate
                 'condition' => $bManage,
                 'content' => array(
                     'js_object' => $sJsObject,
-                    'id' => $iPollId
+                    'id' => $iPollId,
+                    'editor_id' => isset($CNF['FIELD_TEXT_ID']) ? $CNF['FIELD_TEXT_ID'] : ''
                 )
             ),
             'text' => bx_process_output($aPoll[$CNF['FIELD_POLL_TEXT']], BX_DATA_TEXT),

+ 9 - 2
modules/base/text/js/polls.js

@@ -104,10 +104,10 @@ BxBaseModTextPolls.prototype.embedPoll = function(oLink, iId)
     var sEmbedUrl = this._sActionsUrl + 'embed_poll/' + iId;
     var sHtmlId = 'bx-base-general-poll-' + iId;
 
-    bx_editor_insert_html (this._sEditorId, sHtmlId, '<iframe src="' + sEmbedUrl + '" frameborder="0" width="100%" height="240px"></iframe>');
+    bx_editor_insert_html (this._sEditorId, sHtmlId, '<iframe id="bx-base-text-embed-poll-' + iId + '" src="' + sEmbedUrl + '" frameborder="0" width="100%" height="240px"></iframe>');
 };
 
-BxBaseModTextPolls.prototype.deletePoll = function(oLink, iId)
+BxBaseModTextPolls.prototype.deletePoll = function(oLink, iId, aEditors)
 {
     var $this = this;
 
@@ -119,6 +119,13 @@ BxBaseModTextPolls.prototype.deletePoll = function(oLink, iId)
 
         bx_loading(oPoll, true);
 
+        if(typeof(bx_editor_remove_img) !== 'undefined') {
+            bx_editor_remove_img (
+                aEditors,
+                ['iframe[src="' + $this._sActionsUrl + 'embed_poll/' + iId + '"]', '#bx-base-text-embed-poll-' + iId]
+            );
+        }
+
         jQuery.post (
             $this._sActionsUrl + 'delete_poll/',
             oData,

+ 1 - 1
modules/base/text/template/poll_item.html

@@ -7,7 +7,7 @@
                     <a class="bx-base-text-poll-action bx-base-text-pa-icon bx-base-text-pa-embed bx-def-margin-sec-left-auto" href="javascript:void(0)" onclick="javascript:__js_object__.embedPoll(this, __id__);" title="<bx_text_attribute:_sys_txt_form_entry_input_picture_insert />"><i class="sys-icon plus-square"></i></a>
                 </bx_if:show_action_embed>
                 <bx_if:show_action_delete>
-                    <a class="bx-base-text-poll-action bx-base-text-pa-icon bx-base-text-pa-delete bx-def-margin-sec-left-auto" href="javascript:void(0)" onclick="javascript:__js_object__.deletePoll(this, __id__);" title="<bx_text_attribute:_Delete />"><i class="sys-icon times"></i></a>
+                    <a class="bx-base-text-poll-action bx-base-text-pa-icon bx-base-text-pa-delete bx-def-margin-sec-left-auto" href="javascript:void(0)" onclick="javascript:__js_object__.deletePoll(this, __id__, ['__editor_id__']);" title="<bx_text_attribute:_Delete />"><i class="sys-icon times"></i></a>
                 </bx_if:show_action_delete>
             </div>
             <div class="bx-base-text-poll-question bx-def-padding-bottom bx-def-font-h3">__text__</div>