- if(this.type === 'textSelection') {
- if(!anchorNode || !focusNode) {
- return;
- }
- if(anchorNode.isSiblingOf(focusNode)) {
- return doc.createFragment(doc.TextRangeFragment, {
- node1: anchorNode,
- offset1: this.nativeSelection.anchorOffset,
- node2: focusNode,
- offset2: this.nativeSelection.focusOffset,
- });
- }
- else {
- var siblingParents = doc.getSiblingParents({node1: anchorNode, node2: focusNode});
- return doc.createFragment(doc.RangeFragment, {
- node1: siblingParents.node1,
- node2: siblingParents.node2
- });
- }
- }
- if(this.type === 'node') {
- return doc.createFragment(doc.NodeFragment, {node: this.canvas.getCurrentNodeElement().wlxmlNode});
+ if(menu.actions.length) {
+ menu.updateContextParam('fragment', this.getSelection().toDocumentFragment());
+ this.sandbox.showContextMenu(menu, {x: coors.x, y: coors.y});