fix: canvas again gets opportunity to react to footnote being closed
[fnpeditor.git] / src / editor / modules / documentCanvas / canvas / documentElement.js
index 7325938..b2e25ed 100644 (file)
@@ -5,7 +5,7 @@ define([
 ], function($, _, utils) {
     
 'use strict';
-/* global Node:false, document:false */
+/* global Node:false */
 
 // DocumentElement represents a text or an element node from WLXML document rendered inside Canvas
 var DocumentElement = function(wlxmlNode, canvas) {
@@ -26,9 +26,6 @@ $.extend(DocumentElement.prototype, {
     refresh: function() {
         // noop
     },
-    bound: function() {
-        return $.contains(document.documentElement, this.dom()[0]);
-    },
     dom: function() {
         return this.$element;
     },
@@ -54,22 +51,8 @@ $.extend(DocumentElement.prototype, {
         return other && (typeof other === typeof this) && other.dom()[0] === this.dom()[0];
     },
 
-    getPreviousTextElement: function(includeInvisible) {
-        return this.getNearestTextElement('above', includeInvisible);
-    },
-
-    getNextTextElement: function(includeInvisible) {
-        return this.getNearestTextElement('below', includeInvisible);
-    },
-
-    getNearestTextElement: function(direction, includeInvisible) {
-        includeInvisible = includeInvisible !== undefined ? includeInvisible : false;
-        var selector = '[document-text-element]' + (includeInvisible ? '' : ':visible');
-        return this.canvas.getDocumentElement(utils.nearestInDocumentOrder(selector, direction, this.dom()[0]));
-    },
-
     trigger: function() {
-        //this.canvas.bus.trigger()
+        this.canvas.eventBus.trigger.apply(this.canvas.eventBus, Array.prototype.slice.call(arguments, 0));
     }
 
 
@@ -265,35 +248,11 @@ $.extend(DocumentTextElement.prototype, {
 
 });
 
-var SpanElement = function() {
-    DocumentNodeElement.apply(this, Array.prototype.slice.call(arguments, 0));
-};
-SpanElement.prototype = $.extend(Object.create(DocumentNodeElement.prototype), {
-    defaultDisplayStyle: 'inline',
-    init: function() {
-        if(this.containsBlock()) {
-            this.displayAsBlock();
-        } else {
-            this.displayInline();
-        }
-    },
-    refresh: function() {
-        this.init();
-    }
-});
-
-var elements = {
-    span: SpanElement
-};
-
 
 return {
     DocumentElement: DocumentElement,
     DocumentNodeElement: DocumentNodeElement,
-    DocumentTextElement: DocumentTextElement, //,
-    factoryForTag: function(tagName) {
-        return elements[tagName] || DocumentNodeElement;
-    }
+    DocumentTextElement: DocumentTextElement
 };
 
 });
\ No newline at end of file