From 3a305b8258782797b328f2ce46e8bb74e9603594 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Mon, 28 Nov 2016 01:20:23 +0800 Subject: Update editor other cursor classes and adding option for other cursors features in CodeMirror --- public/css/index.css | 13 ++--------- public/js/index.js | 15 +++++++------ public/vendor/codemirror/codemirror.min.js | 34 ++++++++++++++--------------- public/vendor/codemirror/lib/codemirror.css | 14 ++++++++++++ public/vendor/codemirror/lib/codemirror.js | 26 ++++++++++++---------- 5 files changed, 56 insertions(+), 46 deletions(-) diff --git a/public/css/index.css b/public/css/index.css index d586128e..b8779774 100644 --- a/public/css/index.css +++ b/public/css/index.css @@ -241,16 +241,7 @@ body { .dropdown-menu > li > a { cursor: pointer; } -.other-cursors { - position:relative; - z-index:3; -} -.other-cursor { - width: 0px; - position: absolute; - border-right: none; -} -.dropdown-menu.other-cursor { +.dropdown-menu.CodeMirror-other-cursor { transition: none; } .cursortag { @@ -288,7 +279,7 @@ div[contenteditable]:empty:not(:focus):before{ .dropdown-menu .emoji { margin-bottom: 0 !important; } -.dropdown-menu.other-cursor { +.dropdown-menu.CodeMirror-other-cursor { max-height: 50vh; width: auto !important; overflow: auto; diff --git a/public/js/index.js b/public/js/index.js index f49c9da1..341db69e 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -455,6 +455,7 @@ window.editor = CodeMirror.fromTextArea(textit, { addModeClass: true, readOnly: true, autoRefresh: true, + otherCursors: true, placeholder: "← Start by entering a title here\n===\nVisit /features if you don't know what to do.\nHappy hacking :)" }); var inlineAttach = inlineAttachment.editors.codemirror4.attach(editor); @@ -2719,7 +2720,7 @@ socket.on('online users', function (data) { console.debug(data); onlineUsers = data.users; updateOnlineStatus(); - $('.other-cursors').children().each(function (key, value) { + $('.CodeMirror-other-cursors').children().each(function (key, value) { var found = false; for (var i = 0; i < data.users.length; i++) { var user = data.users[i]; @@ -3044,11 +3045,11 @@ function buildCursor(user) { iconClass = 'fa-desktop'; break; } - if ($('.other-cursors').length <= 0) { - $("