You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2017/11/29 04:21:36 UTC

openmeetings git commit: [OPENMEETINGS-1769] style buttons are grouped, add link is improved

Repository: openmeetings
Updated Branches:
  refs/heads/4.0.x fa1a8f321 -> e215e9be4


[OPENMEETINGS-1769] style buttons are grouped, add link is improved


Project: http://git-wip-us.apache.org/repos/asf/openmeetings/repo
Commit: http://git-wip-us.apache.org/repos/asf/openmeetings/commit/e215e9be
Tree: http://git-wip-us.apache.org/repos/asf/openmeetings/tree/e215e9be
Diff: http://git-wip-us.apache.org/repos/asf/openmeetings/diff/e215e9be

Branch: refs/heads/4.0.x
Commit: e215e9be4c68960bd43b5cdb3fc2f95873093c97
Parents: fa1a8f3
Author: Maxim Solodovnik <so...@gmail.com>
Authored: Wed Nov 29 11:21:28 2017 +0700
Committer: Maxim Solodovnik <so...@gmail.com>
Committed: Wed Nov 29 11:21:28 2017 +0700

----------------------------------------------------------------------
 .../openmeetings/web/user/chat/ChatToolbar.html | 18 +++++++++----
 .../openmeetings/web/user/chat/chat-base.js     | 27 +++++++++++++++++---
 openmeetings-web/src/main/webapp/css/chat.css   |  9 +++++++
 3 files changed, 46 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/openmeetings/blob/e215e9be/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/chat/ChatToolbar.html
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/chat/ChatToolbar.html b/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/chat/ChatToolbar.html
index e4e49b7..9310799 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/chat/ChatToolbar.html
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/chat/ChatToolbar.html
@@ -50,15 +50,23 @@
 				<li><a data-edit="fontSize 3"><font size="2">Normal</font></a></li>
 				<li><a data-edit="fontSize 1"><font size="1">Small</font></a></li>
 			</ul>
-			<a id="bold" class="chat btn btn-default" data-edit="bold" title="Bold (Ctrl/Cmd+B)"> B </a> <a
-			id="italic" class="chat btn btn-default" data-edit="italic" title="Italic (Ctrl/Cmd+I)" style="font-style: italic;"> I </a> <a
-			id="strikethrough" class="chat btn btn-default" data-edit="strikethrough" title="Strikethrough" style="text-decoration: line-through;"> S </a> <a
-			id="underline" class="chat btn btn-default" data-edit="underline" title="Underline (Ctrl/Cmd+U)" style="text-decoration: underline;"> U </a>
+		</div>
+		<div class="btn-group dropup">
+			<a id="fontStyle" class="chat btn btn-default dropdown-toggle" data-toggle="dropdown" title="Font Style">
+				<span>&nbsp;</span>
+				<b class="caret"></b>
+			</a>
+			<ul class="dropdown-menu">
+				<li><a id="bold" data-edit="bold" title="Bold (Ctrl/Cmd+B)" style="font-weight: bold;"> B </a></li>
+				<li><a id="italic" data-edit="italic" title="Italic (Ctrl/Cmd+I)" style="font-style: italic;"> I </a></li>
+				<li><a id="strikethrough" data-edit="strikethrough" title="Strikethrough" style="text-decoration: line-through;"> S </a></li>
+				<li><a id="underline" data-edit="underline" title="Underline (Ctrl/Cmd+U)" style="text-decoration: underline;"> U </a></li>
+			</ul>
 		</div>
 		<div class="btn-group">
 			<a id="hyperlink" class="chat btn btn-default dropdown-toggle" data-toggle="dropdown" title="Hyperlink">&nbsp;</a>
 			<div class="dropdown-menu input-append">
-				<input class="span2" placeholder="URL" type="text" data-edit="createLink"/>
+				<input class="span2" placeholder="URL" type="text"/>
 				<button class="btn btn-default" type="button"><wicket:message key="1261"/></button>
 			</div>
 		</div>

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/e215e9be/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/chat/chat-base.js
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/chat/chat-base.js b/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/chat/chat-base.js
index 67665f4..02aa81b 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/chat/chat-base.js
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/chat/chat-base.js
@@ -76,6 +76,9 @@ var Chat = function() {
 			_updateBtn(s, a);
 			Settings.save(s);
 		});
+		$('#chat #hyperlink').parent().find('button').off().click(function() {
+			_insertLink();
+		});
 	}
 	function isClosed() {
 		return p.hasClass('closed');
@@ -311,7 +314,7 @@ var Chat = function() {
 			_close();
 		}
 	}
-	function _emtClick(emoticon) {
+	function _editorAppend(emoticon) {
 		editor.html(editor.html() + ' ' + emoticon + ' ').trigger('change');
 	}
 	function _clean() {
@@ -327,7 +330,25 @@ var Chat = function() {
 			ctrl.height(h);
 		}
 	}
-
+	function _insertLink() {
+		const text = $('#chat #hyperlink').parent().find('input').val();
+		if ('' === text) {
+			return;
+		}
+		const a = $('<div>').append($('<a></a>').attr('target', '_blank').attr('href', text).text(text)).html();
+		if (window.getSelection) {
+			const sel = window.getSelection();
+			if (sel.rangeCount) {
+				const range = sel.getRangeAt(0);
+				if ($(range.startContainer).parents('.wysiwyg-editor').length > 0) {
+					range.deleteContents();
+					range.insertNode(a);
+				} else {
+					_editorAppend(a);
+				}
+			}
+		}
+	}
 	return {
 		reinit: _reinit
 		, removeTab: _removeTab
@@ -341,7 +362,7 @@ var Chat = function() {
 		}
 		, close: _close
 		, toggle: _toggle
-		, emtClick: _emtClick
+		, emtClick: _editorAppend
 		, setRoomMode: _setRoomMode
 		, setHeight: _setHeight
 		, clean: _clean

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/e215e9be/openmeetings-web/src/main/webapp/css/chat.css
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/main/webapp/css/chat.css b/openmeetings-web/src/main/webapp/css/chat.css
index 65152d3..26cf254 100644
--- a/openmeetings-web/src/main/webapp/css/chat.css
+++ b/openmeetings-web/src/main/webapp/css/chat.css
@@ -91,6 +91,15 @@
 	background-image: url(images/link.png);
 	background-position: center;
 }
+#chat #fontStyle span {
+	background-repeat: no-repeat;
+	background-image: url(images/settings.png);
+	background-position: center;
+	background-size: 16px;
+	display: inline-block;
+	width: 20px;
+	height: 20px;
+}
 #chat .chat-btn {
 	display: inline-block;
 	float: right;