- 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,4 +1,5 @@
|
||||
function start_svg_edit() {
|
||||
var url = "chrome://svg-edit/content/editor/svg-editor.html";
|
||||
window.openDialog(url, "SVG Editor", "width=1024,height=700,menubar=no,toolbar=no");
|
||||
/* eslint-disable no-var */
|
||||
function startSvgEdit () { // eslint-disable-line no-unused-vars
|
||||
var url = 'chrome://svg-edit/content/editor/svg-editor.html';
|
||||
window.openDialog(url, 'SVG Editor', 'width=1024,height=700,menubar=no,toolbar=no');
|
||||
}
|
||||
|
||||
@@ -11,14 +11,14 @@
|
||||
|
||||
<menupopup id="menu_ToolsPopup">
|
||||
<menuitem insertafter="devToolsSeparator" label="SVG Editor"
|
||||
oncommand="start_svg_edit();" />
|
||||
oncommand="startSvgEdit();" />
|
||||
</menupopup>
|
||||
|
||||
<!-- Firefox -->
|
||||
<statusbar id="status-bar">
|
||||
<statusbarpanel id="svg-edit-statusbar-button"
|
||||
<statusbarpanel id="svg-edit-statusbar-button"
|
||||
class="statusbarpanel-menu-iconic"
|
||||
onclick="return start_svg_edit()"
|
||||
onclick="return startSvgEdit()"
|
||||
tooltip="SvgEdit">
|
||||
</statusbarpanel>
|
||||
</statusbar>
|
||||
|
||||
@@ -1,55 +1,56 @@
|
||||
/* eslint-disable no-var */
|
||||
/* global $, Components, svgCanvas, netscape */
|
||||
// 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.Components) return;
|
||||
$(function () {
|
||||
if (!window.Components) return;
|
||||
|
||||
function moz_file_picker(readflag) {
|
||||
var fp = window.Components.classes["@mozilla.org/filepicker;1"].
|
||||
createInstance(Components.interfaces.nsIFilePicker);
|
||||
if(readflag)
|
||||
fp.init(window, "Pick a SVG file", fp.modeOpen);
|
||||
else
|
||||
fp.init(window, "Pick a SVG file", fp.modeSave);
|
||||
fp.defaultExtension = "*.svg";
|
||||
fp.show();
|
||||
return fp.file;
|
||||
function mozFilePicker (readflag) {
|
||||
var fp = window.Components.classes['@mozilla.org/filepicker;1']
|
||||
.createInstance(Components.interfaces.nsIFilePicker);
|
||||
if (readflag) fp.init(window, 'Pick a SVG file', fp.modeOpen);
|
||||
else fp.init(window, 'Pick a SVG file', fp.modeSave);
|
||||
fp.defaultExtension = '*.svg';
|
||||
fp.show();
|
||||
return fp.file;
|
||||
}
|
||||
|
||||
svgCanvas.setCustomHandlers({
|
||||
'open':function() {
|
||||
try {
|
||||
netscape.security.PrivilegeManager.
|
||||
enablePrivilege("UniversalXPConnect");
|
||||
var file = moz_file_picker(true);
|
||||
if(!file)
|
||||
return(null);
|
||||
|
||||
var inputStream = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream);
|
||||
inputStream.init(file, 0x01, 00004, null);
|
||||
var sInputStream = Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance(Components.interfaces.nsIScriptableInputStream);
|
||||
sInputStream.init(inputStream);
|
||||
svgCanvas.setSvgString(sInputStream.
|
||||
read(sInputStream.available()));
|
||||
} catch(e) {
|
||||
console.log("Exception while attempting to load" + e);
|
||||
}
|
||||
},
|
||||
'save':function(svg, str) {
|
||||
open: function () {
|
||||
try {
|
||||
var file = moz_file_picker(false);
|
||||
if(!file)
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
var file = mozFilePicker(true);
|
||||
if (!file) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var inputStream = Components.classes['@mozilla.org/network/file-input-stream;1'].createInstance(Components.interfaces.nsIFileInputStream);
|
||||
inputStream.init(file, 0x01, parseInt('00004', 8), null);
|
||||
var sInputStream = Components.classes['@mozilla.org/scriptableinputstream;1'].createInstance(Components.interfaces.nsIScriptableInputStream);
|
||||
sInputStream.init(inputStream);
|
||||
svgCanvas.setSvgString(sInputStream.read(sInputStream.available()));
|
||||
} catch (e) {
|
||||
console.log('Exception while attempting to load' + e);
|
||||
}
|
||||
},
|
||||
save: function (svg, str) {
|
||||
try {
|
||||
var file = mozFilePicker(false);
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!file.exists())
|
||||
file.create(0, 0664);
|
||||
if (!file.exists()) {
|
||||
file.create(0, parseInt('0664', 8));
|
||||
}
|
||||
|
||||
var out = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
|
||||
out.init(file, 0x20 | 0x02, 00004,null);
|
||||
var out = Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream);
|
||||
out.init(file, 0x20 | 0x02, parseInt('00004', 8), null);
|
||||
out.write(str, str.length);
|
||||
out.flush();
|
||||
out.close();
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
alert(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user