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:
1726f58
)
integration wip: highlight/dim/select node via family tree
author
Aleksander Łukasz
<aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 20 Nov 2013 09:50:14 +0000
(10:50 +0100)
committer
Aleksander Łukasz
<aleksander.lukasz@nowoczesnapolska.org.pl>
Mon, 2 Dec 2013 13:50:53 +0000
(14:50 +0100)
src/editor/modules/documentCanvas/canvas/canvas.js
patch
|
blob
|
history
src/editor/modules/documentCanvas/documentCanvas.js
patch
|
blob
|
history
src/editor/modules/nodeFamilyTree/nodeFamilyTree.js
patch
|
blob
|
history
src/editor/modules/rng/rng.js
patch
|
blob
|
history
diff --git
a/src/editor/modules/documentCanvas/canvas/canvas.js
b/src/editor/modules/documentCanvas/canvas/canvas.js
index
3a662e9
..
b0d461b
100644
(file)
--- a/
src/editor/modules/documentCanvas/canvas/canvas.js
+++ b/
src/editor/modules/documentCanvas/canvas/canvas.js
@@
-110,6
+110,11
@@
$.extend(Canvas.prototype, {
return documentElement.DocumentNodeElement.fromHTMLElement(this.d.get(0), this); //{wlxmlTag: this.d.prop('tagName')};
},
return documentElement.DocumentNodeElement.fromHTMLElement(this.d.get(0), this); //{wlxmlTag: this.d.prop('tagName')};
},
+ toggleElementHighlight: function(node, toggle) {
+ var element = utils.findCanvasElement(node);
+ element.toggleHighlight(toggle);
+ },
+
createNodeElement: function(params) {
return documentElement.DocumentNodeElement.create(params, this);
},
createNodeElement: function(params) {
return documentElement.DocumentNodeElement.create(params, this);
},
@@
-230,6
+235,10
@@
$.extend(Canvas.prototype, {
setCurrentElement: function(element, params) {
setCurrentElement: function(element, params) {
+ if(!(element instanceof documentElement.DocumentElement)) {
+ element = utils.findCanvasElement(element);
+ }
+
params = _.extend({caretTo: 'end'}, params);
var findFirstDirectTextChild = function(e, nodeToLand) {
var byBrowser = this.getCursor().getPosition().element;
params = _.extend({caretTo: 'end'}, params);
var findFirstDirectTextChild = function(e, nodeToLand) {
var byBrowser = this.getCursor().getPosition().element;
diff --git
a/src/editor/modules/documentCanvas/documentCanvas.js
b/src/editor/modules/documentCanvas/documentCanvas.js
index
a398f26
..
3ca4e46
100644
(file)
--- a/
src/editor/modules/documentCanvas/documentCanvas.js
+++ b/
src/editor/modules/documentCanvas/documentCanvas.js
@@
-53,14
+53,14
@@
return function(sandbox) {
}
sandbox.publish('currentNodeElementChanged', currentNodeElement);
},
}
sandbox.publish('currentNodeElementChanged', currentNodeElement);
},
- highlightElement: function(
element
) {
-
element.toggleHighlight(
true);
+ highlightElement: function(
node
) {
+
canvas.toggleElementHighlight(node,
true);
},
},
- dimElement: function(
element
) {
-
element.toggleHighlight(
false);
+ dimElement: function(
node
) {
+
canvas.toggleElementHighlight(node,
false);
},
},
- jumpToElement: function(
element
) {
- canvas.setCurrentElement(
element
);
+ jumpToElement: function(
node
) {
+ canvas.setCurrentElement(
node
);
},
command: function(command, params) {
commands.run(command, params, canvas);
},
command: function(command, params) {
commands.run(command, params, canvas);
diff --git
a/src/editor/modules/nodeFamilyTree/nodeFamilyTree.js
b/src/editor/modules/nodeFamilyTree/nodeFamilyTree.js
index
fde220b
..
610901a
100644
(file)
--- a/
src/editor/modules/nodeFamilyTree/nodeFamilyTree.js
+++ b/
src/editor/modules/nodeFamilyTree/nodeFamilyTree.js
@@
-27,16
+27,16
@@
return function(sandbox) {
var view = this;
this.dom.on('click', 'a', function(e) {
var target = $(e.target);
var view = this;
this.dom.on('click', 'a', function(e) {
var target = $(e.target);
- sandbox.publish('
element
Clicked', target.data('element'));
+ sandbox.publish('
node
Clicked', target.data('element'));
});
this.dom.on('mouseenter', 'a', function(e) {
var target = $(e.target);
});
this.dom.on('mouseenter', 'a', function(e) {
var target = $(e.target);
- sandbox.publish('
element
Entered', target.data('element'));
+ sandbox.publish('
node
Entered', target.data('element'));
});
this.dom.on('mouseleave', 'a', function(e) {
var target = $(e.target);
});
this.dom.on('mouseleave', 'a', function(e) {
var target = $(e.target);
- sandbox.publish('
element
Left', target.data('element'));
+ sandbox.publish('
node
Left', target.data('element'));
});
},
setElement: function(element) {
});
},
setElement: function(element) {
diff --git
a/src/editor/modules/rng/rng.js
b/src/editor/modules/rng/rng.js
index
614fc76
..
58f4dee
100644
(file)
--- a/
src/editor/modules/rng/rng.js
+++ b/
src/editor/modules/rng/rng.js
@@
-191,14
+191,14
@@
return function(sandbox) {
ready: function() {
views.currentNodePaneLayout.appendView(sandbox.getModule('nodeFamilyTree').getView());
},
ready: function() {
views.currentNodePaneLayout.appendView(sandbox.getModule('nodeFamilyTree').getView());
},
-
elementEntered: function(element
) {
- commands.highlightDocumentElement(
element
, 'nodeFamilyTree');
+
nodeEntered: function(node
) {
+ commands.highlightDocumentElement(
node
, 'nodeFamilyTree');
},
},
-
elementLeft: function(element
) {
- commands.dimDocumentElement(
element
, 'nodeFamilyTree');
+
nodeLeft: function(node
) {
+ commands.dimDocumentElement(
node
, 'nodeFamilyTree');
},
},
-
elementClicked: function(element
) {
- commands.jumpToDocumentElement(
element
);
+
nodeClicked: function(node
) {
+ commands.jumpToDocumentElement(
node
);
}
};
}
};