- Linting (ESLint): Stricter rules (or switch to warning)
- Breaking internal API change: `updateGripCursor` moved to be class method of Selector rather than instance method - Breaking internal API change: `subpathIsClosed` moved to be class method of `Path` rather than instance method - Refactoring: Reuse utilities base64 encoder for SVG icons plugin - Docs (JSDoc): Fix return of the `mouseUp` (can also be an object) and `mouseDown` (may also be a boolean) of `pathActions`; other JSDoc additions/improvements
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
/**
|
||||
* Opens the dialog with the SVG Editor.
|
||||
* @returns {undefined}
|
||||
*/
|
||||
function startSvgEdit () { // eslint-disable-line no-unused-vars
|
||||
const url = 'chrome://svg-edit/content/editor/svg-editor.html';
|
||||
window.openDialog(url, 'SVG Editor', 'width=1024,height=700,menubar=no,toolbar=no');
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
jQuery(function () {
|
||||
if (!window.Components) return;
|
||||
|
||||
/**
|
||||
* Offer choice of file.
|
||||
* @param {boolean} readflag
|
||||
* @returns {nsILocalFile}
|
||||
*/
|
||||
function mozFilePicker (readflag) {
|
||||
const fp = window.Components.classes['@mozilla.org/filepicker;1']
|
||||
.createInstance(Components.interfaces.nsIFilePicker);
|
||||
@@ -19,16 +24,16 @@ jQuery(function () {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
const file = mozFilePicker(true);
|
||||
if (!file) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
const inputStream = Components.classes['@mozilla.org/network/file-input-stream;1'].createInstance(Components.interfaces.nsIFileInputStream);
|
||||
inputStream.init(file, 0x01, parseInt('00004', 8), null);
|
||||
inputStream.init(file, 0x01, 0o00004, null);
|
||||
const 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);
|
||||
console.log('Exception while attempting to load' + e); // eslint-disable-line no-console
|
||||
}
|
||||
},
|
||||
save (svg, str) {
|
||||
@@ -39,16 +44,16 @@ jQuery(function () {
|
||||
}
|
||||
|
||||
if (!file.exists()) {
|
||||
file.create(0, parseInt('0664', 8));
|
||||
file.create(0, 0o0664);
|
||||
}
|
||||
|
||||
const out = Components.classes['@mozilla.org/network/file-output-stream;1'].createInstance(Components.interfaces.nsIFileOutputStream);
|
||||
out.init(file, 0x20 | 0x02, parseInt('00004', 8), null);
|
||||
out.init(file, 0x20 | 0x02, 0o00004, null); // eslint-disable-line no-bitwise
|
||||
out.write(str, str.length);
|
||||
out.flush();
|
||||
out.close();
|
||||
} catch (e) {
|
||||
alert(e);
|
||||
alert(e); // eslint-disable-line no-alert
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user