Ver código fonte

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

RomanL 8 anos atrás
pai
commit
d44fc290de

+ 2 - 0
modules/boonex/russian/data/langs/bx_timeline/ru.xml

@@ -137,6 +137,8 @@
 
 	<string name="_bx_timeline_menu_title_post_attachments"><![CDATA[Форма - Прикрепления]]></string>
     <string name="_bx_timeline_menu_set_title_post_attachments"><![CDATA[Форма - Прикрепления]]></string>
+    <string name="_bx_timeline_menu_item_title_system_add_emoji"><![CDATA[Добавить Emoji]]></string>
+    <string name="_bx_timeline_menu_item_title_add_emoji"><![CDATA[Добавить Emoji]]></string>
     <string name="_bx_timeline_menu_item_title_system_add_link"><![CDATA[Добавить ссылку]]></string>
     <string name="_bx_timeline_menu_item_title_add_link"><![CDATA[Добавить ссылку]]></string>
     <string name="_bx_timeline_menu_item_title_system_add_photo"><![CDATA[Добавить фото]]></string>

+ 1 - 0
modules/boonex/timeline/classes/BxTimelineConfig.php

@@ -169,6 +169,7 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
                 'attach_link_popup' =>  $sHp . '-attach-link-popup',
                 'attach_link_form_field' => $sHp . '-attach-link-form_field',
                 'attach_link_item' => $sHp . '-attach-link-item-',
+            	'textarea' => $sHp . '-textarea-',
 
             	'main_' . $sHpT => $sHp . '-' . $sHpT,
             	'main_' . $sHpO => $sHp . '-' . $sHpO,

+ 8 - 1
modules/boonex/timeline/classes/BxTimelineFormPost.php

@@ -30,6 +30,13 @@ class BxTimelineFormPost extends BxBaseModGeneralFormEntry
 		$this->aFormAttrs['action'] = BX_DOL_URL_ROOT . $this->_oModule->_oConfig->getBaseUri() . 'post/';
         $this->aInputs['owner_id']['value'] = $iOwnerId;
 
+        if(isset($this->aInputs['text'])) {
+            if(empty($this->aInputs['text']['attrs']) || !is_array($this->aInputs['text']['attrs']))
+                $this->aInputs['text']['attrs'] = array();
+
+            $this->aInputs['text']['attrs']['id'] = $this->_oModule->_oConfig->getHtmlIds('post', 'textarea') . time();
+        }
+
         if(isset($this->aInputs['object_privacy_view'])) {
             $this->aInputs['object_privacy_view'] = array_merge($this->aInputs['object_privacy_view'], BxDolPrivacy::getGroupChooser($this->_oModule->_oConfig->getObject('privacy_view'), 0, array(
                 'title' => _t('_bx_timeline_form_post_input_object_privacy_view')
@@ -108,7 +115,7 @@ class BxTimelineFormPost extends BxBaseModGeneralFormEntry
         if(in_array($this->aParams['display'], array($this->_oModule->_oConfig->getObject('form_display_post_add'), $this->_oModule->_oConfig->getObject('form_display_post_add_public'))))
             $oEditor->setCustomConf("
                 placeholderText: '" . _t('_bx_timeline_txt_some_text_here') . "',
-                initOnClick: true,
+                initOnClick: false,
             ");
 
         $oEditor->setCustomToolbarButtons('');

+ 6 - 1
modules/boonex/timeline/classes/BxTimelineTemplate.php

@@ -33,6 +33,7 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
 
         $this->addCss(array(
         	BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'flickity/|flickity.css',
+        	BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'emoji/css/|emoji.css',
             'jquery-ui/jquery-ui.css',
 			'cmts.css',
             'post.css',
@@ -43,11 +44,15 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
             'jquery-ui/jquery-ui.custom.min.js',
             'jquery.form.min.js',
             'jquery.ba-resize.min.js',
+        	'emoji/js/util.js',
+        	'emoji/js/config.js',
+            'emoji/js/emoji-picker.js',
         	'autosize.min.js',
             'masonry.pkgd.min.js',
             'modernizr.js',
         	'flickity/flickity.pkgd.min.js',
-            'BxDolCmts.js',
+			'emoji/js/jquery.emojiarea.js',
+            'BxDolCmts.js',            
             'post.js',
             'repost.js',
         ));

+ 2 - 0
modules/boonex/timeline/install/langs/en.xml

@@ -137,6 +137,8 @@
 
 	<string name="_bx_timeline_menu_title_post_attachments"><![CDATA[Form Attachments]]></string>
     <string name="_bx_timeline_menu_set_title_post_attachments"><![CDATA[Form Attachments]]></string>
+    <string name="_bx_timeline_menu_item_title_system_add_emoji"><![CDATA[Add Emoji]]></string>
+    <string name="_bx_timeline_menu_item_title_add_emoji"><![CDATA[Add Emoji]]></string>
     <string name="_bx_timeline_menu_item_title_system_add_link"><![CDATA[Add Link]]></string>
     <string name="_bx_timeline_menu_item_title_add_link"><![CDATA[Add Link]]></string>
     <string name="_bx_timeline_menu_item_title_system_add_photo"><![CDATA[Add Photo]]></string>

+ 1 - 0
modules/boonex/timeline/install/sql/enable.sql

@@ -100,6 +100,7 @@ INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES
 ('bx_timeline_menu_post_attachments', 'bx_timeline', '_bx_timeline_menu_set_title_post_attachments', 0);
 
 INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `addon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `editable`, `order`) VALUES 
+('bx_timeline_menu_post_attachments', 'bx_timeline', 'add-emoji', '_bx_timeline_menu_item_title_system_add_emoji', '_bx_timeline_menu_item_title_add_emoji', 'javascript:void(0)', '', '_self', 'smile-o', '', '', 2147483647, 1, 0, 1, 0),
 ('bx_timeline_menu_post_attachments', 'bx_timeline', 'add-link', '_bx_timeline_menu_item_title_system_add_link', '_bx_timeline_menu_item_title_add_link', 'javascript:void(0)', 'javascript:{js_object}.showAttachLink(this);', '_self', 'link', '', '', 2147483647, 1, 0, 1, 1),
 ('bx_timeline_menu_post_attachments', 'bx_timeline', 'add-photo', '_bx_timeline_menu_item_title_system_add_photo', '_bx_timeline_menu_item_title_add_photo', 'javascript:void(0)', 'javascript:{js_object_uploader_photo}.showUploaderForm();', '_self', 'camera', '', '', 2147483647, 1, 0, 1, 2),
 ('bx_timeline_menu_post_attachments', 'bx_timeline', 'add-video', '_bx_timeline_menu_item_title_system_add_video', '_bx_timeline_menu_item_title_add_video', 'javascript:void(0)', 'javascript:{js_object_uploader_video}.showUploaderForm();', '_self', 'video-camera', '', '', 2147483647, 1, 0, 1, 3);

+ 19 - 1
modules/boonex/timeline/js/post.js

@@ -25,6 +25,22 @@ function BxTimelinePost(oOptions) {
     this._sPregUrl = "\\b((https?://)|(www\\.))(([0-9a-zA-Z_!~*'().&=+$%-]+:)?[0-9a-zA-Z_!~*'().&=+$%-]+\\@)?(([0-9]{1,3}\\.){3}[0-9]{1,3}|([0-9a-zA-Z_!~*'()-]+\\.)*([0-9a-zA-Z][0-9a-zA-Z-]{0,61})?[0-9a-zA-Z]\\.[a-zA-Z]{2,6})(:[0-9]{1,4})?((/[0-9a-zA-Z_!~*'().;?:\\@&=+$,%#-]+)*/?)";
     this._oAttachedLinks = {};
 
+    if (typeof window.glOnInitEditor === 'undefined')
+	    window.glOnInitEditor = [];
+
+	window.glOnInitEditor.push(function (sEditorSelector) {
+		var oLink = $(sEditorSelector).parents('form:first').find('a.add-emoji');
+
+		var oEmojiConf = {
+		    emojiable_selector: bx_editor_get_htmleditable(sEditorSelector), 
+		    convert_to_emoji: 0, /* allow to convert members manually typed symbols to unicode smiles, like :slightly_smiling_face: */
+		    popup_position: {right:'1rem'},
+		    menu_wrapper: oLink.parent(), /* selector for element into which to add emoji popup menu icon */
+		    menu_icon: oLink  /* emoji popup menu icon */
+		};
+		new EmojiPicker(oEmojiConf ).discover();  /* call init emoji function */
+	});
+
     var $this = this;
     $(document).ready(function () {
     	$($this.sIdPost + ' form').each(function() {
@@ -40,8 +56,10 @@ BxTimelinePost.prototype.initFormPost = function(sFormId)
 {
 	var $this = this;
 	var oForm = $('#' + sFormId);
+	var oTextarea = oForm.find('textarea');
+
+	autosize(oTextarea);
 
-	autosize(oForm.find('textarea'));
 	oForm.ajaxForm({
         dataType: "json",
         beforeSubmit: function (formData, jqForm, options) {

+ 10 - 0
modules/boonex/timeline/template/css/post.css

@@ -65,3 +65,13 @@ div.bx-tl-ali-actions .bx-btn {
 	display: inline-block;
 	float: none;
 }
+
+/*--- Add Emoji Styles ---*/
+.bx-menu-btn.add-emoji {
+	position: relative;
+}
+
+/*--- Froala Styles ---*/
+.bx-form-input-wrapper-textarea .fr-toolbar {
+	z-index: 0;
+}

+ 2 - 2
modules/boonex/timeline/template/menu_buttons_hor.html

@@ -1,7 +1,7 @@
 <ul class="bx-menu-btns-hor bx-menu-object-__object__ bx-clearfix">
     <bx_repeat:menu_items>
-        <li class="bx-def-margin-sec-left-auto __class_add__">
-            <a class="bx-btn" href="__link__" target="__target__" onclick="__onclick__" title="__title__">
+        <li class="bx-menu-btn __name__ bx-def-margin-sec-left-auto __class_add__">
+            <a class="bx-btn __name__" href="__link__" target="__target__" onclick="__onclick__" title="__title__">
                 <bx_if:image><img style="background-image:url(__icon_url__)" src="<bx_icon_url:spacer.gif />" /></bx_if:image>
                 <bx_if:icon><i class="sys-icon __icon__"></i></bx_if:icon>
             </a>

+ 0 - 61
plugins_public/emoji/css/emoji.css

@@ -43,67 +43,6 @@ img.emoji {
     height: 1em;
 }
 
-.emoji-wysiwyg-editor:empty:before {
-    content: attr(placeholder);
-    color: #9aa2ab;
-}
-
-.emoji-picker-container {
-    position: relative;
-}
-
-.emoji-picker-icon.parent-has-scroll {
-    right: 28px;
-}
-
-.emoji-picker-icon:hover {
-    opacity: 1;
-}
-
-/* Emoji area */
-.emoji-wysiwyg-editor:empty:before {
-    content: attr(placeholder);
-    color: #ccc;
-}
-
-.emoji-wysiwyg-editor:active:before,
-.emoji-wysiwyg-editor:focus:before {
-    content: none;
-}
-
-.emoji-wysiwyg-editor {
-    padding-right: 2.4rem;
-    margin-bottom: 0px;
-    min-height: 35px;
-    height: 30px;    
-    overflow: auto;
-    line-height: 17px;
-    border: 1px solid #d2dbe3;
-    border-radius: 2px;
-    -webkit-box-shadow: none;
-    box-shadow: none;
-    -webkit-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
-    transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
-    -webkit-user-select: text;
-    word-wrap: break-word;
-}
-
-.emoji-wysiwyg-editor.parent-has-scroll {
-     padding-right: 40px;
- }
-
-.emoji-wysiwyg-editor.single-line-editor {
-    min-height: 35px;
-    height: inherit;
-}
-
-.emoji-wysiwyg-editor img {
-    width: 20px;
-    height: 20px;
-    vertical-align: middle;
-    margin: -3px 0 0 0;
-}
-
 .emoji-menu {
     position: absolute;
     right: 0;

Diferenças do arquivo suprimidas por serem muito extensas
+ 2 - 3
plugins_public/emoji/js/config.js


+ 83 - 68
plugins_public/emoji/js/jquery.emojiarea.js

@@ -40,6 +40,8 @@
     iconSize : 25,
     icons : {},
   };
+  
+  
   var defaultRecentEmojis = ':joy:,:kissing_heart:,:heart:,:heart_eyes:,:blush:,:grin:,:+1:,:relaxed:,:pensive:,:smile:,:sob:,:kiss:,:unamused:,:flushed:,:stuck_out_tongue_winking_eye:,:see_no_evil:,:wink:,:smiley:,:cry:,:stuck_out_tongue_closed_eyes:,:scream:,:rage:,:smirk:,:disappointed:,:sweat_smile:,:kissing_closed_eyes:,:speak_no_evil:,:relieved:,:grinning:,:yum:,:laughing:,:ok_hand:,:neutral_face:,:confused:'
       .split(',');
   /* ! MODIFICATION END */
@@ -110,29 +112,34 @@
   })();
 
   util.replaceSelection = (function() {
-    if (window.getSelection) {
-      return function(content) {
-        var range, sel = window.getSelection();
-        var node = typeof content === 'string' ? document
-            .createTextNode(content) : content;
-        if (sel.getRangeAt && sel.rangeCount) {
-          range = sel.getRangeAt(0);
-          range.deleteContents();
-          //range.insertNode(document.createTextNode(''));
-          range.insertNode(node);
-          range.setStart(node, 0);
-
-          window.setTimeout(function() {
-            range = document.createRange();
-            range.setStartAfter(node);
-            range.collapse(true);
-            sel.removeAllRanges();
-            sel.addRange(range);
-          }, 0);
-        }
+	if (window.getSelection)
+	{
+	   return function(content)
+	   {
+			var range, sel = window.getSelection();
+			var node = typeof content === 'string' ? document.createTextNode(content) : content;
+			if (sel.getRangeAt && sel.rangeCount) {
+			  range = sel.getRangeAt(0);
+			  range.deleteContents();			  
+			  range.insertNode(node);
+			  range.setStart(node, 0);
+
+			  window.setTimeout(function()
+			  {
+				range = document.createRange();
+				range.setStartAfter(node);
+				range.collapse(true);
+				sel.removeAllRanges();
+				sel.addRange(range);				
+			  }, 0);
+			}
+			
       }
-    } else if (document.selection && document.selection.createRange) {
-      return function(content) {
+    }
+	else if (document.selection && document.selection.createRange)
+	{
+      return function(content)
+	  {
         var range = document.selection.createRange();
         if (typeof content === 'string') {
           range.text = content;
@@ -143,9 +150,10 @@
     }
   })();
 
-  util.insertAtCursor = function(text, el) {
+  util.insertAtCursor = function(text, el)
+{
     text = ' ' + text;
-    var val = el.value, endIndex, startIndex, range;
+	var val = el.value, endIndex, startIndex, range;
     if (typeof el.selectionStart != 'undefined'
         && typeof el.selectionEnd != 'undefined') {
       startIndex = el.selectionStart;
@@ -314,15 +322,13 @@
     this.id = id;
     this.$textarea = $textarea;
     this.emojiPopup = options.emojiPopup;
-    this.$editor = $('<div>').addClass('emoji-wysiwyg-editor').addClass($($textarea)[0].className);
-    this.$editor.data('self', this);
-
-    if ($textarea.attr('maxlength'))
-      this.$editor.attr('maxlength', $textarea.attr('maxlength'));
     
-   if ($textarea.text().length)
-		this.$editor.text($textarea.text()); 
+	this.$editor = $(this.$textarea).addClass('emoji-wysiwyg-editor');
+	this.$editor.data('self', this);
 	
+    if ($textarea.attr('maxlength'))
+      this.$editor.attr('maxlength', $textarea.attr('maxlength'));
+
 	this.$editor.attr({
       'data-id': id,
       'data-type': 'input',
@@ -363,7 +369,7 @@
 		return $this;
 	});
 
-    var editorDiv = this.$editor;
+    /*var editorDiv = this.$editor;
     this.$editor.on("change keydown keyup resize scroll", function(e) {
       if(MAX_LENGTH_ALLOWED_KEYS.indexOf(e.which) == -1 &&
         !((e.ctrlKey || e.metaKey) && e.which == 65) && // Ctrl + A
@@ -372,7 +378,7 @@
       {
         e.preventDefault();
       }
-      self.updateBodyPadding(editorDiv);
+      //self.updateBodyPadding(editorDiv);
 	  
 	  if(e.which == 8 || e.which == 46)
 		  $(this).trigger('change');
@@ -396,25 +402,26 @@
         editorDiv.scrollTop(editorDiv[0].scrollHeight);
       });
     }
-  	
+  	*/
 	if (typeof options.custom_events !== 'undefined')
 	{
 		for(evt in options.custom_events)			
 			this.$editor.on(evt, options.custom_events[evt]);
 	}
 	
-	$textarea.hide().after(this.$editor);
+	//$textarea.hide().after(this.$editor);
 
 	var oMenuWrapper = typeof this.options.menu_wrapper !== 'undefined' ? $(this.options.menu_wrapper) : $('<a class="smiles"></i>'),
-		oMenuIcon = typeof this.options.menu_icon !== 'undefined' ? $(this.options.menu_icon) : '<i class="sys-icon smile-o">';
+		oMenuIcon = typeof this.options.menu_icon !== 'undefined' ? $(this.options.menu_icon) : $('<i class="sys-icon smile-o">');
 	
-	oMenuWrapper
-		.html(
-				oMenuIcon
-					.attr('data-id', id)
-					.attr('data-type', 'picker')
-					.addClass('emoji-picker-icon emoji-picker')
-				);
+	oMenuIcon
+		.attr('data-id', id)
+		.attr('data-type', 'picker')
+		.addClass('emoji-picker-icon emoji-picker');
+					
+	//console.log(id);
+	if (typeof this.options.menu_wrapper !== 'undefined')
+		$(this.options.menu_wrapper).html(oMenuIcon);
 	
 	if (typeof this.options.menu_wrapper == 'undefined')
 		$(this.$editor).after(oMenuWrapper);
@@ -426,11 +433,11 @@
      * MODIFICATION: Following line was modified by Igor Zhukov, in order to
      * improve emoji insert behaviour
      */
-    $(document.body).on('mousedown', function() {
-      if (self.hasFocus) {
-        self.selection = util.saveSelection();
-      }
-    });
+	$(document.body).on('mousedown', function() {
+	  if (self.hasFocus) {
+		self.selection = util.saveSelection();
+	  }
+	});
   };
 
   EmojiArea_WYSIWYG.prototype.updateBodyPadding = function(target) {
@@ -450,28 +457,36 @@
 
   EmojiArea_WYSIWYG.prototype.onChange = function(e)
   {	
-	this.$textarea.val(this.val()).trigger('change');
+	//this.$textarea.val(this.val()).trigger('change');
   };
 
   EmojiArea_WYSIWYG.prototype.insert = function(emoji) {
     var insertionContent = this.emojiPopup.colonToUnicode(emoji);
 
-    this.$editor.trigger('focus');
-    if (this.selection) {
-      util.restoreSelection(this.selection);
-    }
-    try {
-      util.replaceSelection(insertionContent);
-    } catch (e) {
-    }
+	if (!this.$editor.filter("[id='tinymce']").length)
+	{
+		this.$editor.trigger('keydown');	
+		if (this.selection)
+			util.restoreSelection(this.selection);
+		try
+		{
+			util.replaceSelection(insertionContent);			
+		}
+		catch (e)
+		{
+		}
+	}
+	else 
+		tinymce.execCommand('mceInsertContent', false, insertionContent); 
+		
 
     /*
      * MODIFICATION: Following line was added by Igor Zhukov, in order to
      * save recent emojis
      */
-    util.emojiInserted(emoji, this.menu);
-
-    this.onChange();
+   
+	util.emojiInserted(emoji, this.menu);
+    //this.onChange();
   };
   
   EmojiArea_WYSIWYG.prototype.val = function() {
@@ -479,14 +494,14 @@
 		line = [],
 		emojiPopup = this.emojiPopup,
 		_this = this;
-
-    var flush = function() {
+	
+	var flush = function() {
       lines.push(line.join(''));
       line = [];
     };
 
     var sanitizeNode = function(node) {		
-	 if (node.nodeType === TEXT_NODE) {
+	if (node.nodeType === TEXT_NODE) {
 			function escapeRegex(text) {
 				return text.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
 			}
@@ -600,8 +615,9 @@
     this.$items = $('<div class="emoji-items">').appendTo(
         this.$itemsWrap);
 
-    this.emojiarea.$editor.after(this.$menu)
-
+    //this.emojiarea.$editor.after(this.$menu);
+	$('[data-id=' + self.id + '][data-type=picker]').after(this.$menu);
+	
     $body.on('keydown', function(e) {
       if (e.keyCode === KEY_ESC || e.keyCode === KEY_TAB) {
         self.hide();
@@ -646,7 +662,7 @@
 
     this.$menu.on('click', 'a', function(e) {
 
-      self.emojiarea.updateBodyPadding(self.emojiarea.$editor);
+      //self.emojiarea.updateBodyPadding(self.emojiarea.$editor);
       if ($(this).hasClass('emoji-menu-tab'))
 	  {
         if (self.getTabIndex(this) !== self.currentCategory) {
@@ -779,5 +795,4 @@
 
 })(jQuery, window, document);
 
-/** @} */
-
+/** @} */

+ 1 - 1
template/_header.html

@@ -4,7 +4,7 @@
     <bx_injection:injection_head_begin />
 
     <meta http-equiv="Content-Type" content="text/html; charset=__page_charset__" />
-    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" />
     <title>__page_header__</title>
     <base href="<bx_url_root />" />
 

+ 1 - 1
template/page_150.html

@@ -4,7 +4,7 @@
     <bx_injection:injection_head_begin />
     
     <meta http-equiv="Content-Type" content="text/html; charset=__page_charset__" />
-    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" />
     <title>__page_header__</title>
     <base href="<bx_url_root />" />
 

+ 1 - 1
template/page_44.html

@@ -4,7 +4,7 @@
     <bx_injection:injection_head_begin />
     
     <meta http-equiv="Content-Type" content="text/html; charset=__page_charset__" />
-    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" />
     <title>__page_header__</title>
     <base href="<bx_url_root />" />
 

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff