- Linting: ESLint (or ignore) JavaScript files; unfinished: editor/jgraduate and editor/extensions folders, editor/ (root), test/ (root) HTML
- Fix: An apparent bug in jquery.svgicons.js whereby a variable `holder` was declared in too nested of a scope - Fix: `addBezierCurve` in canvg.js had undeclared `i` - Fix: Undeclared variable in opera widget - Fix: Screencast `showNotes`
This commit is contained in:
@@ -1,62 +1,59 @@
|
||||
/* eslint-disable no-var */
|
||||
/* globals $, svgCanvas */
|
||||
// Note: This JavaScript file must be included as the last script on the main HTML editor page to override the open/save handlers
|
||||
$(function() {
|
||||
if(window.opera && window.opera.io && window.opera.io.filesystem) {
|
||||
$(function () {
|
||||
if (window.opera && window.opera.io && window.opera.io.filesystem) {
|
||||
svgCanvas.setCustomHandlers({
|
||||
'open':function() {
|
||||
open: function () {
|
||||
try {
|
||||
window.opera.io.filesystem.browseForFile(
|
||||
new Date().getTime(), /* mountpoint name */
|
||||
"", /* default location */
|
||||
function(file) {
|
||||
'', /* default location */
|
||||
function (file) {
|
||||
try {
|
||||
if (file) {
|
||||
fstream = file.open(file, "r");
|
||||
var output = "";
|
||||
var fstream = file.open(file, 'r');
|
||||
var output = '';
|
||||
while (!fstream.eof) {
|
||||
output += fstream.readLine();
|
||||
}
|
||||
|
||||
|
||||
svgCanvas.setSvgString(output); /* 'this' is bound to the filestream object here */
|
||||
}
|
||||
}
|
||||
catch(e) {
|
||||
console.log("Reading file failed.");
|
||||
} catch (e) {
|
||||
console.log('Reading file failed.');
|
||||
}
|
||||
},
|
||||
false, /* not persistent */
|
||||
false, /* no multiple selections */
|
||||
"*.svg" /* file extension filter */
|
||||
'*.svg' /* file extension filter */
|
||||
);
|
||||
} catch (e) {
|
||||
console.log('Open file failed.');
|
||||
}
|
||||
catch(e) {
|
||||
console.log("Open file failed.");
|
||||
}
|
||||
|
||||
},
|
||||
'save':function(window, svg) {
|
||||
save: function (window, svg) {
|
||||
try {
|
||||
window.opera.io.filesystem.browseForSave(
|
||||
new Date().getTime(), /* mountpoint name */
|
||||
"", /* default location */
|
||||
function(file) {
|
||||
'', /* default location */
|
||||
function (file) {
|
||||
try {
|
||||
if (file) {
|
||||
var fstream = file.open(file, "w");
|
||||
fstream.write(svg, "UTF-8");
|
||||
var fstream = file.open(file, 'w');
|
||||
fstream.write(svg, 'UTF-8');
|
||||
fstream.close();
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('Write to file failed.');
|
||||
}
|
||||
catch(e) {
|
||||
console.log("Write to file failed.");
|
||||
}
|
||||
},
|
||||
},
|
||||
false /* not persistent */
|
||||
);
|
||||
}
|
||||
catch(e) {
|
||||
console.log("Save file failed.");
|
||||
} catch (e) {
|
||||
console.log('Save file failed.');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -6,14 +6,12 @@
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<script>
|
||||
/** this method adds the script that overrides the default open/save handlers */
|
||||
function addHandlers()
|
||||
{
|
||||
var cdoc = document.getElementById("container").contentDocument;
|
||||
if(cdoc)
|
||||
{
|
||||
var scriptelm = cdoc.createElement("script");
|
||||
scriptelm.src = "../handlers.js";
|
||||
cdoc.getElementsByTagName("head")[0].appendChild(scriptelm);
|
||||
function addHandlers () {
|
||||
var cdoc = document.getElementById('container').contentDocument;
|
||||
if (cdoc) {
|
||||
var scriptelm = cdoc.createElement('script');
|
||||
scriptelm.src = '../handlers.js';
|
||||
cdoc.getElementsByTagName('head')[0].appendChild(scriptelm);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user