Lint fixes.
This commit is contained in:
@@ -6353,33 +6353,35 @@ const CLIPBOARD_ID = 'svgedit_clipboard';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Flash the clipboard data momentarily on localStorage so all tabs can see.
|
* Flash the clipboard data momentarily on localStorage so all tabs can see.
|
||||||
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
function flashStorage() {
|
function flashStorage () {
|
||||||
const data = sessionStorage.getItem(CLIPBOARD_ID);
|
const data = sessionStorage.getItem(CLIPBOARD_ID);
|
||||||
localStorage.setItem(CLIPBOARD_ID, data);
|
localStorage.setItem(CLIPBOARD_ID, data);
|
||||||
setTimeout(function() {
|
setTimeout(function () {
|
||||||
localStorage.removeItem(CLIPBOARD_ID);
|
localStorage.removeItem(CLIPBOARD_ID);
|
||||||
}, 1);
|
}, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transfers sessionStorage from one tab to another.
|
* Transfers sessionStorage from one tab to another.
|
||||||
* @param {Event} event Storage event.
|
* @param {!Event} ev Storage event.
|
||||||
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
function storageChange(event) {
|
function storageChange (ev) {
|
||||||
if (!event.newValue) return; // This is a call from removeItem.
|
if (!ev.newValue) return; // This is a call from removeItem.
|
||||||
if (event.key === CLIPBOARD_ID + '_startup') {
|
if (ev.key === CLIPBOARD_ID + '_startup') {
|
||||||
// Another tab asked for our sessionStorage.
|
// Another tab asked for our sessionStorage.
|
||||||
localStorage.removeItem(CLIPBOARD_ID + '_startup');
|
localStorage.removeItem(CLIPBOARD_ID + '_startup');
|
||||||
flashStorage();
|
flashStorage();
|
||||||
} else if (event.key === CLIPBOARD_ID) {
|
} else if (ev.key === CLIPBOARD_ID) {
|
||||||
// Another tab sent data.
|
// Another tab sent data.
|
||||||
sessionStorage.setItem(CLIPBOARD_ID, event.newValue);
|
sessionStorage.setItem(CLIPBOARD_ID, ev.newValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Listen for changes to localStorage.
|
// Listen for changes to localStorage.
|
||||||
window.addEventListener("storage", storageChange, false);
|
window.addEventListener('storage', storageChange, false);
|
||||||
// Ask other tabs for sessionStorage (this is ONLY to trigger event).
|
// Ask other tabs for sessionStorage (this is ONLY to trigger event).
|
||||||
localStorage.setItem(CLIPBOARD_ID + '_startup', Math.random());
|
localStorage.setItem(CLIPBOARD_ID + '_startup', Math.random());
|
||||||
|
|
||||||
@@ -6389,13 +6391,13 @@ localStorage.setItem(CLIPBOARD_ID + '_startup', Math.random());
|
|||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
this.copySelectedElements = function () {
|
this.copySelectedElements = function () {
|
||||||
const data = JSON.stringify(
|
const data =
|
||||||
selectedElements.map(function (x) { return getJsonFromSvgElement(x); }));
|
JSON.stringify(selectedElements.map((x) => getJsonFromSvgElement(x)));
|
||||||
// Use sessionStorage for the clipboard data.
|
// Use sessionStorage for the clipboard data.
|
||||||
sessionStorage.setItem(CLIPBOARD_ID, data);
|
sessionStorage.setItem(CLIPBOARD_ID, data);
|
||||||
flashStorage();
|
flashStorage();
|
||||||
|
|
||||||
let menu = $('#cmenu_canvas');
|
const menu = $('#cmenu_canvas');
|
||||||
// Context menu might not exist (it is provided by editor.js).
|
// Context menu might not exist (it is provided by editor.js).
|
||||||
if (menu.enableContextMenuItems) {
|
if (menu.enableContextMenuItems) {
|
||||||
menu.enableContextMenuItems('#paste,#paste_in_place');
|
menu.enableContextMenuItems('#paste,#paste_in_place');
|
||||||
|
|||||||
Reference in New Issue
Block a user