last bug fixes for TextBind type (for now)

This commit is contained in:
Kevin Jahns 2015-07-16 06:53:47 +02:00
parent f78dc52d7b
commit 4a7f09c32d
3 changed files with 4 additions and 2 deletions

View File

@ -8,7 +8,7 @@
<script src="./index.js"></script>
</head>
<body>
<h1 contentEditable> yjs Tutorial</h1>
<h1 id="contenteditable" contentEditable> yjs Tutorial</h1>
<p> Collaborative Json editing with <a href="https://github.com/rwth-acis/yjs/">yjs</a>
and XMPP Connector. </p>

View File

@ -12,12 +12,14 @@ Y({
window.y = yconfig.root;
window.yconfig = yconfig;
var textarea = document.getElementById("textfield");
var contenteditable = document.getElementById("contenteditable");
yconfig.root.observe(function(events){
for (var e in events) {
var event = events[e];
if (event.name === "text" && (event.type === "add" || event.type === "update")) {
event.object.get(event.name).then(function(text){ //eslint-disable-line
text.bind(textarea);
text.bind(contenteditable);
window.ytext = text;
});
}

View File

@ -70,7 +70,7 @@
};
writeRange = function (range) {
writeContent(word.val());
writeContent(word.toString());
var textnode = textfield.childNodes[0];
if(range.isReal && textnode != null) {
if(range.left < 0){