apostrophe
Advanced tools
Comparing version 0.4.21 to 0.4.22
{ | ||
"name": "apostrophe", | ||
"version": "0.4.21", | ||
"version": "0.4.22", | ||
"description": "Apostrophe is a user-friendly content management system. This core module of Apostrophe provides rich content editing and essential facilities to integrate Apostrophe into your Express project. Apostrophe also includes simple facilities for storing your rich content areas in MongoDB and fetching them back again. Additional functionality is available in modules like apostrophe-pages, apostrophe-snippets, apostrophe-blog, apostrophe-events, apostrophe-twitter and apostrophe-rss.", | ||
@@ -61,2 +61,2 @@ "main": "apostrophe.js", | ||
"license": "MIT" | ||
} | ||
} |
@@ -377,7 +377,7 @@ /* global rangy, $, _ */ | ||
var saved = rangy.saveSelection(); | ||
var next = outer.clone(); | ||
next.html(inner.nextAll()); | ||
$(outer).html(inner.prevAll()); | ||
inner.insertAfter(outer); | ||
next.insertAfter(inner); | ||
var next = inner.clone(); | ||
apos.moveYoungerSiblings(inner[0], next[0]); | ||
apos.moveYoungerSiblings(outer[0], next[0]); | ||
apos.keepOlderSiblings(inner[0]); | ||
next.insertAfter(outer); | ||
rangy.restoreSelection(saved); | ||
@@ -464,10 +464,15 @@ }); | ||
var p, n; | ||
var saved; | ||
if (node.previousSibling) { | ||
if (node.previousSibling.nodeValue === null) { | ||
p = document.createTextNode(before); | ||
saved = rangy.saveSelection(); | ||
$(node).before(p); | ||
rangy.restoreSelection(saved); | ||
} else { | ||
p = node.previousSibling.nodeValue; | ||
if (p.substr(p.length - 1, 1) !== before) { | ||
saved = rangy.saveSelection(); | ||
node.previousSibling.nodeValue += before; | ||
rangy.restoreSelection(saved); | ||
} | ||
@@ -479,7 +484,11 @@ } | ||
p = document.createTextNode(after); | ||
saved = rangy.saveSelection(); | ||
$(node).after(p); | ||
rangy.restoreSelection(saved); | ||
} else { | ||
n = node.nextSibling.nodeValue; | ||
if (n.substr(0, 1) !== after) { | ||
saved = rangy.saveSelection(); | ||
node.nextSibling.nodeValue = after + node.nextSibling.nodeValue; | ||
rangy.restoreSelection(saved); | ||
} | ||
@@ -1952,1 +1961,20 @@ } | ||
}; | ||
// Keep all older siblings of node, remove the rest (including node) from the DOM. | ||
apos.keepOlderSiblings = function(node) { | ||
while (node) { | ||
var next = node.nextSibling; | ||
node.parentNode.removeChild(node); | ||
node = next; | ||
} | ||
}; | ||
// Append all DOM sibling nodes after node, including | ||
// text nodes, to target. This includes text nodes | ||
apos.moveYoungerSiblings = function(node, target) { | ||
var sibling = node.nextSibling; | ||
while (sibling) { | ||
target.insertBefore(sibling, null); | ||
sibling = node.nextSibling; | ||
} | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4191873
16830