Browse Source

Merge branch 'master' of https://github.com/unaio/una

RomanL 8 năm trước cách đây
mục cha
commit
b877bd359c

+ 18 - 0
inc/classes/BxDolEditor.php

@@ -61,6 +61,8 @@ class BxDolEditor extends BxDolFactory implements iBxDolFactoryObject
 {
     protected $_sObject;
     protected $_aObject;
+    protected $_sConfCustom = '';
+    protected $_sButtonsCustom = false;
 
     /**
      * Constructor
@@ -111,6 +113,22 @@ class BxDolEditor extends BxDolFactory implements iBxDolFactoryObject
         return $this->_sObject;
     }
 
+    /**
+     * Set custom editor configuration options
+     */
+    public function setCustomConf ($s)
+    {
+        $this->_sConfCustom = $s;
+    }
+
+    /**
+     * Set custom toolbar
+     */
+    public function setCustomToolbarButtons ($sButtons)
+    {
+        $this->_sButtonsCustom = $sButtons;
+    }
+
     /**
      * Get minimal width which is neede for editor for the provided view mode
      */

+ 14 - 0
inc/js/editor.tinymce.js

@@ -21,6 +21,20 @@ function bx_editor_insert_img (sEditorId, sImgId, sImgUrl, sClasses) {
     eEditor.execCommand('mceInsertContent', false, '<img id="' + sImgId + '" class="' + sClasses + '" src="' + sImgUrl + '" />');
 }
 
+function bx_editor_on_init (sEditorId)
+{
+    if (typeof glOnInitEditor !== 'undefined' && glOnInitEditor instanceof Array) {
+        for (var i = 0; i < glOnInitEditor.length; i++)
+            if (typeof glOnInitEditor[i] === "function")
+                glOnInitEditor[i](sEditorId);
+    }
+}
+
+function bx_editor_on_space_enter (sEditorId)
+{
+    // TODO:
+}
+
 function bx_editor_remove_img (aEditorIds, aMarkers) {
     if ('object' != typeof(tinymce))
         return;

+ 2 - 19
modules/boonex/froala/classes/BxFroalaEditor.php

@@ -42,6 +42,8 @@ class BxFroalaEditor extends BxDolEditor
                     if (e.which == $.FroalaEditor.KEYCODE.ENTER && editor.\$el.atwho('isSelecting'))
                         return false;
                 }, true);
+
+                bx_editor_on_init('{bx_var_selector}');
             })
             .froalaEditor({
                 {bx_var_custom_init}
@@ -73,9 +75,6 @@ EOS;
      */
     protected static $CONF_FULL = "";
 
-    protected $_sConfCustom = '';
-    protected $_sButtonsCustom = false;
-
     /**
      * Available editor languages
      */
@@ -93,22 +92,6 @@ EOS;
         else
             $this->_oTemplate = BxDolTemplate::getInstance();
     }
-
-    /**
-     * Set custom configuration option
-     */
-    public function setCustomConf ($s)
-    {
-        $this->_sConfCustom = $s;
-    }
-
-    /**
-     * Set custom toolbar
-     */
-    public function setCustomToolbarButtons ($sButtons)
-    {
-        $this->_sButtonsCustom = $sButtons;
-    }
     
     /**
      * Attach editor to HTML element, in most cases - textarea.

+ 10 - 1
modules/boonex/froala/js/editor.js

@@ -34,6 +34,15 @@ function bx_editor_remove_img (aEditorIds, aMarkers)
     }
 }
 
+function bx_editor_on_init (sEditorId)
+{
+    if (typeof glOnInitEditor !== 'undefined' && glOnInitEditor instanceof Array) {
+        for (var i = 0; i < glOnInitEditor.length; i++)
+            if (typeof glOnInitEditor[i] === "function")
+                glOnInitEditor[i](sEditorId);
+    }
+}
+
 function bx_editor_on_space_enter (sEditorId)
 {
     if (typeof glBxEditorOnSpaceEnterTimer !== 'undefined')
@@ -44,7 +53,7 @@ function bx_editor_on_space_enter (sEditorId)
         if (typeof glOnSpaceEnterInEditor !== 'undefined' && glOnSpaceEnterInEditor instanceof Array) {
             for (var i = 0; i < glOnSpaceEnterInEditor.length; i++)
                 if (typeof glOnSpaceEnterInEditor[i] === "function")
-                    glOnSpaceEnterInEditor[i]($(sEditorId).froalaEditor('html.get'));
+                    glOnSpaceEnterInEditor[i]($(sEditorId).froalaEditor('html.get'), sEditorId);
         }
     }, 800);
 }

+ 1 - 0
modules/boonex/intercom/classes/BxIntercomModule.php

@@ -26,6 +26,7 @@ class BxIntercomModule extends BxDolModule
 
         $aSettings = array(
             'app_id' => $sAppId,
+            'hide_default_launcher' => ('messenger' == bx_get('i')),
             'alignment' => getParam('bx_intercom_option_alignment'),
             'horizontal_padding' => getParam('bx_intercom_option_horizontal_padding'),
             'vertical_padding' => getParam('bx_intercom_option_vertical_padding'),

+ 2 - 10
template/scripts/BxBaseEditorTinyMCE.php

@@ -51,6 +51,8 @@ class BxBaseEditorTinyMCE extends BxDolEditor
                                 },
 
                             });
+
+                            bx_editor_on_init('{bx_var_selector}');
                         },
                         setup: function(editor) {
                             editor.on('keydown', function(e) {
@@ -149,8 +151,6 @@ EOS;
                         image_advtab: true,
     ";
 
-    protected $_sConfCustom = '';
-
     /**
      * Available editor languages
      */
@@ -169,14 +169,6 @@ EOS;
             $this->_oTemplate = BxDolTemplate::getInstance();
     }
 
-    /**
-     * Set custom TinyMCE configuration option
-     */
-    public function setCustomConf ($s)
-    {
-        $this->_sConfCustom = $s;
-    }
-
     /**
      * Attach editor to HTML element, in most cases - textarea.
      * @param $sSelector - jQuery selector to attach editor to.