This commit is contained in:
Kevin Jahns
2018-04-27 18:33:28 +02:00
parent 99f92cb9a0
commit a54d826d6d
20 changed files with 82 additions and 77 deletions

View File

@@ -1,7 +1,7 @@
/* global Y, d3 */
const hooks = {
"magic-drawing": {
'magic-drawing': {
fillType: function (dom, type) {
initDrawingBindings(type, dom)
},
@@ -19,7 +19,7 @@ window.onload = function () {
window.addMagicDrawing = function addMagicDrawing () {
let mt = document.createElement('magic-drawing')
mt.dataset.yjsHook = 'magic-drawing'
mt.setAttribute('data-yjs-hook', 'magic-drawing')
document.body.append(mt)
}
@@ -30,7 +30,7 @@ var renderPath = d3.svg.line()
function initDrawingBindings (type, dom) {
dom.contentEditable = 'false'
dom.dataset.yjsHook = 'magic-drawing'
dom.setAttribute('data-yjs-hook', 'magic-drawing')
var drawing = type.get('drawing')
if (drawing === undefined) {
drawing = type.set('drawing', new Y.Array())

View File

@@ -9,5 +9,5 @@ let y = new Y('xml-example', {
window.yXml = y
// bind xml type to a dom, and put it in body
window.sharedDom = y.define('xml', Y.XmlElement).getDom()
window.sharedDom = y.define('xml', Y.XmlElement).toDom()
document.body.appendChild(window.sharedDom)