X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/e54a6bc1fa5737591083883e7e610745e2eec168..808306985627fd87f75a1b61fbd2d2b0fa61b186:/modules/documentCanvas/canvas/documentElement.js diff --git a/modules/documentCanvas/canvas/documentElement.js b/modules/documentCanvas/canvas/documentElement.js index 425978f..9768236 100644 --- a/modules/documentCanvas/canvas/documentElement.js +++ b/modules/documentCanvas/canvas/documentElement.js @@ -2,8 +2,10 @@ define([ 'libs/jquery-1.9.1.min', 'libs/underscore-min', 'modules/documentCanvas/classAttributes', -'modules/documentCanvas/canvas/utils' -], function($, _, classAttributes, utils) { +'modules/documentCanvas/canvas/utils', +'modules/documentCanvas/canvas/widgets', +'modules/documentCanvas/canvas/wlxmlManagers' +], function($, _, classAttributes, utils, widgets, wlxmlManagers) { 'use strict'; @@ -32,9 +34,9 @@ $.extend(DocumentElement, { fromHTMLElement: function(htmlElement, canvas) { var $element = $(htmlElement); - if(htmlElement.nodeType === Node.ELEMENT_NODE && $element.attr('wlxml-tag')) + if(htmlElement.nodeType === Node.ELEMENT_NODE && $element.attr('document-node-element') !== undefined) return DocumentNodeElement.fromHTMLElement(htmlElement, canvas); - if($element.attr('wlxml-text') !== undefined || (htmlElement.nodeType === Node.TEXT_NODE && $element.parent().attr('wlxml-text') !== undefined)) + if($element.attr('document-text-element') !== undefined || (htmlElement.nodeType === Node.TEXT_NODE && $element.parent().attr('document-text-element') !== undefined)) return DocumentTextElement.fromHTMLElement(htmlElement, canvas); return undefined; } @@ -44,11 +46,14 @@ $.extend(DocumentElement.prototype, { _setupDOMHandler: function(htmlElement) { this.$element = $(htmlElement); }, + bound: function() { + return this.canvas !== undefined; + }, dom: function() { return this.$element; }, parent: function() { - var parents = this.$element.parents('[wlxml-tag]'); + var parents = this.$element.parents('[document-node-element]'); if(parents.length) return DocumentElement.fromHTMLElement(parents[0], this.canvas); return null; @@ -113,30 +118,39 @@ var DocumentNodeElement = function(htmlElement, canvas) { }; $.extend(DocumentNodeElement, { - createDOM: function(params) { + createDOM: function(params, canvas) { var dom = $('