fnp
/
fnpeditor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
e3d38a1
)
integration: canvas fixes
author
Aleksander Łukasz
<aleksander.lukasz@nowoczesnapolska.org.pl>
Mon, 7 Oct 2013 14:08:59 +0000
(16:08 +0200)
committer
Aleksander Łukasz
<aleksander.lukasz@nowoczesnapolska.org.pl>
Mon, 2 Dec 2013 13:50:52 +0000
(14:50 +0100)
src/editor/modules/documentCanvas/canvas/canvas.js
patch
|
blob
|
history
src/editor/modules/documentCanvas/canvas/canvas.test.js
patch
|
blob
|
history
src/editor/modules/documentCanvas/documentCanvas.js
patch
|
blob
|
history
diff --git
a/src/editor/modules/documentCanvas/canvas/canvas.js
b/src/editor/modules/documentCanvas/canvas/canvas.js
index
482afb9
..
8c2e2e1
100644
(file)
--- a/
src/editor/modules/documentCanvas/canvas/canvas.js
+++ b/
src/editor/modules/documentCanvas/canvas/canvas.js
@@
-9,15
+9,18
@@
define([
'use strict';
'use strict';
-var Canvas = function(wlxml, publisher) {
+var Canvas = function(wlxml
Document
, publisher) {
this.eventBus = _.extend({}, Backbone.Events);
this.eventBus = _.extend({}, Backbone.Events);
- this.loadWlxmlDocument(wlxml);
+ this.loadWlxmlDocument(wlxml
Document
);
this.publisher = publisher ? publisher : function() {};
};
$.extend(Canvas.prototype, {
loadWlxmlDocument: function(wlxmlDocument) {
this.publisher = publisher ? publisher : function() {};
};
$.extend(Canvas.prototype, {
loadWlxmlDocument: function(wlxmlDocument) {
+ if(!wlxmlDocument) {
+ return false;
+ }
var canvasDOM = this.generateCanvasDOM(wlxmlDocument.root);
this.wrapper = $('<div>').addClass('canvas-wrapper').attr('contenteditable', true);
var canvasDOM = this.generateCanvasDOM(wlxmlDocument.root);
this.wrapper = $('<div>').addClass('canvas-wrapper').attr('contenteditable', true);
@@
-550,8
+553,8
@@
$.extend(Cursor.prototype, {
})
return {
})
return {
- fromXML
: function(wlxmlNode
, publisher) {
- return new Canvas(wlxml
Node
, publisher);
+ fromXML
Document: function(wlxmlDocument
, publisher) {
+ return new Canvas(wlxml
Document
, publisher);
}
};
}
};
diff --git
a/src/editor/modules/documentCanvas/canvas/canvas.test.js
b/src/editor/modules/documentCanvas/canvas/canvas.test.js
index
35b943d
..
f0ba395
100644
(file)
--- a/
src/editor/modules/documentCanvas/canvas/canvas.test.js
+++ b/
src/editor/modules/documentCanvas/canvas/canvas.test.js
@@
-19,7
+19,7
@@
var nodeFromXML = function(xml) {
describe('new Canvas', function() {
it('abc', function() {
var doc = wlxml.WLXMLDocumentFromXML('<section>Alice <span>has</span> a cat!</div>'),
describe('new Canvas', function() {
it('abc', function() {
var doc = wlxml.WLXMLDocumentFromXML('<section>Alice <span>has</span> a cat!</div>'),
- c = canvas.fromXML(doc);
+ c = canvas.fromXML
Document
(doc);
expect(c.doc().children()).to.have.length(3)
});
expect(c.doc().children()).to.have.length(3)
});
diff --git
a/src/editor/modules/documentCanvas/documentCanvas.js
b/src/editor/modules/documentCanvas/documentCanvas.js
index
84fb086
..
88538c4
100644
(file)
--- a/
src/editor/modules/documentCanvas/documentCanvas.js
+++ b/
src/editor/modules/documentCanvas/documentCanvas.js
@@
-10,7
+10,7
@@
define([
return function(sandbox) {
return function(sandbox) {
- var canvas = canvas3.fromXML
(''
, sandbox.publish);
+ var canvas = canvas3.fromXML
Document(null
, sandbox.publish);
var canvasWrapper = $(template);
var shownAlready = false;
var scrollbarPosition = 0,
var canvasWrapper = $(template);
var shownAlready = false;
var scrollbarPosition = 0,