0&&n.shouldBeComposedWithInverted(h(this.undoManager.undoStack).wrapped)),s=new t(this.selection,o);this.undoManager.add(new d(n,s),i),this.applyClient(e)},o.prototype.updateSelection=function(){this.selection=this.editorAdapter.getSelection()},o.prototype.onSelectionChange=function(){var t=this.selection;this.updateSelection(),t&&this.selection.equals(t)||this.sendSelection(this.selection)},o.prototype.onBlur=function(){this.selection=null,this.sendSelection(null)},o.prototype.sendSelection=function(t){this.state instanceof c.AwaitingWithBuffer||this.serverAdapter.sendSelection(t)},o.prototype.sendOperation=function(t,e){this.serverAdapter.sendOperation(t,e.toJSON(),this.selection)},o.prototype.getOperations=function(t,e){this.serverAdapter.getOperations(t,e)},o.prototype.applyOperation=function(t){this.editorAdapter.applyOperation(t),this.updateSelection(),this.undoManager.transform(new d(t,null))},o}();
\ No newline at end of file
diff --git a/public/vendor/ot/socketio-adapter.js b/public/vendor/ot/socketio-adapter.js
old mode 100644
new mode 100755
index 329d4f3e..189a081b
--- a/public/vendor/ot/socketio-adapter.js
+++ b/public/vendor/ot/socketio-adapter.js
@@ -24,8 +24,6 @@ ot.SocketIOAdapter = (function () {
self.trigger('selection', clientId, selection);
});
socket.on('operations', function (head, operations) {
- operations = LZString.decompressFromUTF16(operations);
- operations = JSON.parse(operations);
self.trigger('operations', head, operations);
});
socket.on('selection', function (clientId, selection) {
@@ -37,7 +35,6 @@ ot.SocketIOAdapter = (function () {
}
SocketIOAdapter.prototype.sendOperation = function (revision, operation, selection) {
- operation = LZString.compressToUTF16(JSON.stringify(operation));
this.socket.emit('operation', revision, operation, selection);
};
--
cgit v1.2.3
From d9e19b602968551fcda4ee806d767a04f6a11490 Mon Sep 17 00:00:00 2001
From: Wu Cheng-Han
Date: Mon, 2 Jan 2017 11:05:05 +0800
Subject: Update to remove null byte before saving to DB and remove null byte
on changes
---
public/js/index.js | 7 +++++++
1 file changed, 7 insertions(+)
(limited to 'public')
diff --git a/public/js/index.js b/public/js/index.js
index 328b67fe..e62d1dcb 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -3207,6 +3207,12 @@ function buildCursor(user) {
}
//editor actions
+function removeNullByte(cm, change) {
+ var str = change.text.join("\n");
+ if (/\u0000/g.test(str) && change.update) {
+ change.update(change.from, change.to, str.replace(/\u0000/g, "").split("\n"));
+ }
+}
function enforceMaxLength(cm, change) {
var maxLength = cm.getOption("maxLength");
if (maxLength && change.update) {
@@ -3228,6 +3234,7 @@ var ignoreEmitEvents = ['setValue', 'ignoreHistory'];
editor.on('beforeChange', function (cm, change) {
if (debug)
console.debug(change);
+ removeNullByte(cm, change);
if (enforceMaxLength(cm, change)) {
$('.limit-modal').modal('show');
}
--
cgit v1.2.3
From 0db4358adb12b2df1051874829f658496df6910c Mon Sep 17 00:00:00 2001
From: Wu Cheng-Han
Date: Mon, 2 Jan 2017 11:05:49 +0800
Subject: Fix authorship might losing update event because of throttling
---
public/js/index.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'public')
diff --git a/public/js/index.js b/public/js/index.js
index e62d1dcb..2e0513c2 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -2443,7 +2443,7 @@ function updateInfo(data) {
updateAuthorship();
}
}
-var updateAuthorship = _.throttle(function () {
+var updateAuthorship = _.debounce(function () {
editor.operation(updateAuthorshipInner);
}, 50);
function initMark() {
--
cgit v1.2.3
From db0ea715c61c1b82794403cd045f6ccac5aa66c9 Mon Sep 17 00:00:00 2001
From: Wu Cheng-Han
Date: Mon, 2 Jan 2017 11:06:02 +0800
Subject: Update to improve editor performance by debounce checkEditorScrollbar
event
---
public/js/index.js | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
(limited to 'public')
diff --git a/public/js/index.js b/public/js/index.js
index 2e0513c2..56766657 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -1223,7 +1223,11 @@ function checkSyncToggle() {
}
}
-function checkEditorScrollbar() {
+var checkEditorScrollbar = _.debounce(function () {
+ editor.operation(checkEditorScrollbarInner);
+}, 50);
+
+function checkEditorScrollbarInner() {
// workaround simple scroll bar knob
// will get wrong position when editor height changed
var scrollInfo = editor.getScrollInfo();
--
cgit v1.2.3
From d74fea1d10b600f139552c0353da992c4442998b Mon Sep 17 00:00:00 2001
From: Wu Cheng-Han
Date: Mon, 2 Jan 2017 11:14:25 +0800
Subject: Update year to 2017
---
public/views/index.ejs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'public')
diff --git a/public/views/index.ejs b/public/views/index.ejs
index d8d0a76f..84dd2533 100644
--- a/public/views/index.ejs
+++ b/public/views/index.ejs
@@ -149,7 +149,7 @@
- © 2016 HackMD | <%= __('Releases') %>
+ © 2017 HackMD