|
@@ -1710,7 +1710,10 @@ ${ require.config() }
|
|
|
|
|
|
|
|
function saveTemporarySnippet($element, value) {
|
|
function saveTemporarySnippet($element, value) {
|
|
|
if ($element.data('last-active-editor')) {
|
|
if ($element.data('last-active-editor')) {
|
|
|
- $.totalStorage('hue.notebook.lastWrittenSnippet', value);
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ $.totalStorage('hue.notebook.lastWrittenSnippet', value);
|
|
|
|
|
+ }
|
|
|
|
|
+ catch (e){} // storage quota exceeded with enormous editor content
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1905,14 +1908,8 @@ ${ require.config() }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function replaceAce(content) {
|
|
function replaceAce(content) {
|
|
|
- var snip = viewModel.notebooks()[0].snippets()[0],
|
|
|
|
|
- contentLines = content.split('\n');
|
|
|
|
|
- if (contentLines.length > 5000) {
|
|
|
|
|
- $.jHueNotify.warn("${ _('The content you are trying to import is too big and it has been truncated for performance reasons.') }");
|
|
|
|
|
- snip.statement_raw(contentLines.slice(0, 5000).join('\n'));
|
|
|
|
|
- snip.ace().setValue(contentLines.slice(0, 5000).join('\n'));
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ var snip = viewModel.notebooks()[0].snippets()[0];
|
|
|
|
|
+ if (snip) {
|
|
|
snip.statement_raw(content);
|
|
snip.statement_raw(content);
|
|
|
snip.ace().setValue(content);
|
|
snip.ace().setValue(content);
|
|
|
}
|
|
}
|
|
@@ -2016,6 +2013,7 @@ ${ require.config() }
|
|
|
}
|
|
}
|
|
|
catch (e) {
|
|
catch (e) {
|
|
|
hideHoverMsg(viewModel);
|
|
hideHoverMsg(viewModel);
|
|
|
|
|
+ replaceAce(raw);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|