apostrophe
Advanced tools
Comparing version 0.4.20 to 0.4.21
{ | ||
"name": "apostrophe", | ||
"version": "0.4.20", | ||
"version": "0.4.21", | ||
"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.", | ||
@@ -5,0 +5,0 @@ "main": "apostrophe.js", |
@@ -649,2 +649,23 @@ /* jshint undef: true */ | ||
// String.replace does NOT do this | ||
// Regexps can but they can't be trusted with unicode ): | ||
// Keep in sync with server side version | ||
apos.globalReplace = function(haystack, needle, replacement) { | ||
var result = ''; | ||
while (true) { | ||
if (!haystack.length) { | ||
return result; | ||
} | ||
var index = haystack.indexOf(needle); | ||
if (index === -1) { | ||
result += haystack; | ||
return result; | ||
} | ||
result += haystack.substr(0, index); | ||
result += replacement; | ||
haystack = haystack.substr(index + needle.length); | ||
} | ||
}; | ||
// MINOR JQUERY EXTENSIONS | ||
@@ -651,0 +672,0 @@ |
@@ -402,3 +402,3 @@ /* global rangy, $, _ */ | ||
var $container = $widget.closest('.apos-editor'); | ||
var cellWidth = ($container.outerWidth() / 6) | ||
var cellWidth = ($container.outerWidth() / 6); | ||
@@ -875,3 +875,3 @@ // Make widgets resizable if they aren't already | ||
// markup = markup + String.fromCharCode(8288); | ||
// markup = markup + String.fromCharCode(65279); | ||
@@ -1696,2 +1696,8 @@ // Restore the selection to insert the markup into it | ||
if (richText.length) { | ||
// Remove invisible markers used to ensure good behavior of | ||
// webkit inside contenteditable. Some browsers render these | ||
// as boxes (Windows Chrome) if they see them and the font is | ||
// a custom one that doesn't explicitly address this code point | ||
richText = apos.globalReplace(richText, apos.beforeMarker, ''); | ||
richText = apos.globalReplace(richText, apos.afterMarker, ''); | ||
items.push({ type: 'richText', content: richText }); | ||
@@ -1702,5 +1708,13 @@ richText = ''; | ||
// Widgets must never get stuck inside other elements | ||
var hoisted = false; | ||
// Pull it into jQuery land for a few cleanups best done there | ||
var changedInJquery = false; | ||
var $content = $($.parseHTML('<div data-apos-hoist-wrapper>' + content + '</div>')); | ||
// While we have it in jQuery, seize the opportunity to blow out any | ||
// ui-resizable-handles that are still in the DOM | ||
var $handles = $content.find('.ui-resizable-handle'); | ||
if ($handles.length) { | ||
$handles.remove(); | ||
changedInJquery = true; | ||
} | ||
var $widgets = $content.find('[data-type]'); | ||
@@ -1720,6 +1734,6 @@ $widgets.each(function() { | ||
$parent.before($widget); | ||
hoisted = true; | ||
changedInJquery = true; | ||
} | ||
}); | ||
if (hoisted) { | ||
if (changedInJquery) { | ||
content = $content.html(); | ||
@@ -1794,6 +1808,9 @@ } | ||
// The best marker to use as a workaround for webkit selection bugs | ||
// is an invisible one (the Unicode word joiner character). | ||
apos.beforeMarker = String.fromCharCode(8288); // '↢'; | ||
apos.afterMarker = String.fromCharCode(8288); // '↣'; | ||
// is an invisible one (the ZERO WIDTH NO-BREAK SPACE character). | ||
// We tried using 8288 (the WORD JOINER character), but it shows as | ||
// a box in Windows Chrome regardless of font. -Tom | ||
apos.beforeMarker = String.fromCharCode(65279); // was '↢'; | ||
apos.afterMarker = String.fromCharCode(65279); // was '↣'; | ||
(function() { | ||
@@ -1800,0 +1817,0 @@ /* jshint devel: true */ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
4190951
16804