start to clean up and give things more sensible names.
get rid of the textarea entirely
This commit is contained in:
@@ -14,28 +14,17 @@
|
|||||||
left:0px;
|
left:0px;
|
||||||
bottom:0px;
|
bottom:0px;
|
||||||
right:0px;
|
right:0px;
|
||||||
width:70%;
|
width:100%;
|
||||||
height:100%;
|
height:100%;
|
||||||
border:none;
|
border:none;
|
||||||
margin:0;
|
margin:0;
|
||||||
padding:0;
|
padding:0;
|
||||||
overflow:hidden;
|
overflow:hidden;
|
||||||
}
|
}
|
||||||
#feedback {
|
|
||||||
position: fixed;
|
|
||||||
top: 0px;
|
|
||||||
right: 0px;
|
|
||||||
border: 0px;
|
|
||||||
height: 100vh;
|
|
||||||
width: 30vw;
|
|
||||||
background-color: #222;
|
|
||||||
color: #ccc;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<iframe id="pad-iframe" src="inner.html"></iframe>
|
<iframe id="pad-iframe" src="inner.html"></iframe>
|
||||||
<textarea id="feedback"></textarea>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ define([
|
|||||||
var $textarea = $('#feedback');
|
var $textarea = $('#feedback');
|
||||||
|
|
||||||
var setEditable = function (bool) {
|
var setEditable = function (bool) {
|
||||||
// inner.style.backgroundColor = bool? 'unset': 'grey';
|
inner.style.backgroundColor = bool? 'unset': 'grey';
|
||||||
inner.setAttribute('contenteditable', bool);
|
inner.setAttribute('contenteditable', bool);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -197,7 +197,7 @@ define([
|
|||||||
|
|
||||||
var shjson2 = JSON.stringify(Convert.core.hyperjson.fromDOM(inner));
|
var shjson2 = JSON.stringify(Convert.core.hyperjson.fromDOM(inner));
|
||||||
if (shjson2 !== shjson) {
|
if (shjson2 !== shjson) {
|
||||||
rti.propogate(shjson2);
|
rti.patchText(shjson2);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -220,8 +220,8 @@ define([
|
|||||||
var onAbort = function (info) {
|
var onAbort = function (info) {
|
||||||
console.log("Aborting the session!");
|
console.log("Aborting the session!");
|
||||||
// stop the user from continuing to edit
|
// stop the user from continuing to edit
|
||||||
|
// by setting the editable to false
|
||||||
setEditable(false);
|
setEditable(false);
|
||||||
// TODO inform them that the session was torn down
|
|
||||||
toolbar.failed();
|
toolbar.failed();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -246,7 +246,6 @@ define([
|
|||||||
// reject patch if it results in invalid JSON
|
// reject patch if it results in invalid JSON
|
||||||
transformFunction : JsonOT.validate,
|
transformFunction : JsonOT.validate,
|
||||||
|
|
||||||
// websocketURL, ofc
|
|
||||||
websocketURL: Config.websocketURL,
|
websocketURL: Config.websocketURL,
|
||||||
|
|
||||||
// username
|
// username
|
||||||
@@ -259,15 +258,16 @@ define([
|
|||||||
cryptKey: key.cryptKey
|
cryptKey: key.cryptKey
|
||||||
};
|
};
|
||||||
|
|
||||||
var rti = module.realtimeInput = window.rti = realtimeInput.start(realtimeOptions);
|
var rti = module.realtimeInput = realtimeInput.start(realtimeOptions);
|
||||||
|
|
||||||
|
// FIXME Spaghetti code. realtime-input needs access to this variable..
|
||||||
var propogate = window.cryptpad_propogate = function () {
|
var propogate = window.cryptpad_propogate = function () {
|
||||||
var shjson = JSON.stringify(Convert.core.hyperjson.fromDOM(inner, isNotMagicLine));
|
var shjson = JSON.stringify(Convert.core.hyperjson.fromDOM(inner, isNotMagicLine));
|
||||||
if (!rti.propogate(shjson)) { return; }
|
if (!rti.patchText(shjson)) { return; }
|
||||||
rti.onEvent(shjson);
|
rti.onEvent(shjson);
|
||||||
};
|
};
|
||||||
|
|
||||||
var testInput = window.testInput = function (el, offset) {
|
var testInput = function (el, offset) {
|
||||||
var i = 0,
|
var i = 0,
|
||||||
j = offset,
|
j = offset,
|
||||||
input = "The quick red fox jumps over the lazy brown dog. ",
|
input = "The quick red fox jumps over the lazy brown dog. ",
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ define([
|
|||||||
'/bower_components/reconnectingWebsocket/reconnecting-websocket.js',
|
'/bower_components/reconnectingWebsocket/reconnecting-websocket.js',
|
||||||
'/common/crypto.js',
|
'/common/crypto.js',
|
||||||
'/_socket/toolbar.js',
|
'/_socket/toolbar.js',
|
||||||
'/_socket/sharejs_textarea-transport-only.js',
|
'/_socket/text-patcher.js',
|
||||||
'/common/chainpad.js',
|
'/common/chainpad.js',
|
||||||
'/bower_components/jquery/dist/jquery.min.js',
|
'/bower_components/jquery/dist/jquery.min.js',
|
||||||
], function (Messages,/*FIXME*/ ReconnectingWebSocket, Crypto, Toolbar, sharejs) {
|
], function (Messages,/*FIXME*/ ReconnectingWebSocket, Crypto, Toolbar, TextPatcher) {
|
||||||
var $ = window.jQuery;
|
var $ = window.jQuery;
|
||||||
var ChainPad = window.ChainPad;
|
var ChainPad = window.ChainPad;
|
||||||
var PARANOIA = true;
|
var PARANOIA = true;
|
||||||
@@ -326,8 +326,7 @@ define([
|
|||||||
// TODO maybe push this out to the application layer.
|
// TODO maybe push this out to the application layer.
|
||||||
//bindAllEvents(null, doc, onEvent, false);
|
//bindAllEvents(null, doc, onEvent, false);
|
||||||
|
|
||||||
// TODO rename 'sharejs.attach' to imply what we want to do
|
toReturn.patchText = TextPatcher.create({
|
||||||
var genOp = toReturn.propogate = sharejs.attach({
|
|
||||||
realtime: realtime
|
realtime: realtime
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,6 @@ define(function () {
|
|||||||
|
|
||||||
it performs a diff on the two values, and generates patches
|
it performs a diff on the two values, and generates patches
|
||||||
which are then passed into `ctx.remove` and `ctx.insert`
|
which are then passed into `ctx.remove` and `ctx.insert`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
var applyChange = function(ctx, oldval, newval) {
|
var applyChange = function(ctx, oldval, newval) {
|
||||||
// Strings are immutable and have reference equality. I think this test is O(1), so its worth doing.
|
// Strings are immutable and have reference equality. I think this test is O(1), so its worth doing.
|
||||||
@@ -39,7 +36,7 @@ var applyChange = function(ctx, oldval, newval) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var attachTextarea = function(config) {
|
var create = function(config) {
|
||||||
var ctx = config.realtime;
|
var ctx = config.realtime;
|
||||||
|
|
||||||
// initial state will always fail the !== check in genop.
|
// initial state will always fail the !== check in genop.
|
||||||
@@ -70,5 +67,5 @@ var attachTextarea = function(config) {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
return { attach: attachTextarea };
|
return { create: create };
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user