jquery removal, isolate svgcavas from svgedit, tests
This commit is contained in:
@@ -196,11 +196,12 @@ export default {
|
||||
// Create source save/cancel buttons
|
||||
/* const save = */ $('#tool_source_save').clone()
|
||||
.hide().attr('id', 'foreign_save').unbind()
|
||||
.appendTo('#tool_source_back').click(async function () {
|
||||
.appendTo('#tool_source_back').click(function () {
|
||||
if (!editingforeign) { return; }
|
||||
|
||||
if (!setForeignString($('#svg_source_textarea').val())) {
|
||||
const ok = await $.confirm('Errors found. Revert to original?');
|
||||
// eslint-disable-next-line no-alert
|
||||
const ok = confirm('Errors found. Revert to original?');
|
||||
if (!ok) { return; }
|
||||
endChanges();
|
||||
} else {
|
||||
|
||||
@@ -78,7 +78,7 @@ export default {
|
||||
});
|
||||
|
||||
// Show the text using the custom alert function
|
||||
$.alert(text);
|
||||
alert(text); // eslint-disable-line no-alert
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -223,7 +223,7 @@ export default {
|
||||
} else {
|
||||
pending[id].entry.remove();
|
||||
}
|
||||
// await $.alert('Unexpected data was returned: ' + response, function() {
|
||||
// await alert('Unexpected data was returned: ' + response, function() {
|
||||
// if (mode !== 'm') {
|
||||
// closeBrowser();
|
||||
// } else {
|
||||
|
||||
@@ -404,12 +404,13 @@ export default {
|
||||
|
||||
/**
|
||||
* @param {"start"|"mid"|"end"} pos
|
||||
* @returns {Promise<void>} Resolves to `undefined`
|
||||
* @returns {void} Resolves to `undefined`
|
||||
*/
|
||||
async function showTextPrompt (pos) {
|
||||
function showTextPrompt (pos) {
|
||||
let def = $('#' + pos + '_marker').val();
|
||||
if (def.substr(0, 1) === '\\') { def = ''; }
|
||||
const txt = await $.prompt('Enter text for ' + pos + ' marker', def);
|
||||
// eslint-disable-next-line no-alert
|
||||
const txt = prompt('Enter text for ' + pos + ' marker', def);
|
||||
if (txt) {
|
||||
triggerTextEntry(pos, txt);
|
||||
}
|
||||
|
||||
@@ -202,7 +202,8 @@ export default {
|
||||
});
|
||||
} catch (e) {
|
||||
console.log('Failed loading MathJax.'); // eslint-disable-line no-console
|
||||
$.alert('Failed loading MathJax. You will not be able to change the mathematics.');
|
||||
// eslint-disable-next-line no-alert
|
||||
alert('Failed loading MathJax. You will not be able to change the mathematics.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ export default {
|
||||
// Todo: Uncomment the setItexString() function above and handle ajaxEndpoint?
|
||||
/*
|
||||
if (!setItexString($('#svg_source_textarea').val())) {
|
||||
const ok = await $.confirm('Errors found. Revert to original?', function (ok) {
|
||||
const ok = confirm('Errors found. Revert to original?', function (ok) {
|
||||
if (!ok) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,8 @@ export default {
|
||||
<input type="hidden" name="contenttype" value="application/x-svgdraw">
|
||||
`).appendTo('body')
|
||||
.submit().remove();
|
||||
$.alert(strings.saved);
|
||||
// eslint-disable-next-line no-alert
|
||||
alert(strings.saved);
|
||||
top.window.location = '/' + name;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -146,7 +146,8 @@ export default {
|
||||
}
|
||||
|
||||
if (note.length) {
|
||||
await $.alert(note);
|
||||
// eslint-disable-next-line no-alert
|
||||
alert(note);
|
||||
}
|
||||
|
||||
const filename = getFileNameFromTitle();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* globals seSelect */
|
||||
/**
|
||||
* @file ext-storage.js
|
||||
*
|
||||
@@ -181,9 +182,9 @@ export default {
|
||||
const storagePrompt = new URL(top.location).searchParams.get('storagePrompt');
|
||||
const strings = await loadExtensionTranslation(svgEditor.pref('lang'));
|
||||
const {
|
||||
message, storagePrefsAndContent, storagePrefsOnly,
|
||||
message /* , storagePrefsAndContent, storagePrefsOnly,
|
||||
storagePrefs, storageNoPrefsOrContent, storageNoPrefs,
|
||||
rememberLabel, rememberTooltip
|
||||
rememberLabel, rememberTooltip */
|
||||
} = strings;
|
||||
|
||||
// No need to run this one-time dialog again just because the user
|
||||
@@ -213,6 +214,7 @@ export default {
|
||||
)
|
||||
// ...then show the storage prompt.
|
||||
)) {
|
||||
/*
|
||||
const options = [];
|
||||
if (storage) {
|
||||
options.unshift(
|
||||
@@ -226,20 +228,13 @@ export default {
|
||||
{value: 'noPrefsOrContent', text: storageNoPrefs}
|
||||
);
|
||||
}
|
||||
|
||||
// Hack to temporarily provide a wide and high enough dialog
|
||||
const oldContainerWidth = $('#dialog_container')[0].style.width,
|
||||
oldContainerMarginLeft = $('#dialog_container')[0].style.marginLeft,
|
||||
oldContentHeight = $('#dialog_content')[0].style.height,
|
||||
oldContainerHeight = $('#dialog_container')[0].style.height;
|
||||
$('#dialog_content')[0].style.height = '120px';
|
||||
$('#dialog_container')[0].style.height = '170px';
|
||||
$('#dialog_container')[0].style.width = '800px';
|
||||
$('#dialog_container')[0].style.marginLeft = '-400px';
|
||||
*/
|
||||
const options = storage ? ['prefsAndContent', 'prefsOnly', 'noPrefsOrContent'] : ['prefsOnly', 'noPrefsOrContent'];
|
||||
|
||||
// Open select-with-checkbox dialog
|
||||
// From svg-editor.js
|
||||
svgEditor.storagePromptState = 'waiting';
|
||||
/* JFH !!!!!
|
||||
const {response: pref, checked} = await $.select(
|
||||
message,
|
||||
options,
|
||||
@@ -251,6 +246,8 @@ export default {
|
||||
tooltip: rememberTooltip
|
||||
}
|
||||
);
|
||||
*/
|
||||
const pref = await seSelect(message, options);
|
||||
if (pref && pref !== 'noPrefsOrContent') {
|
||||
// Regardless of whether the user opted
|
||||
// to remember the choice (and move to a URL which won't
|
||||
@@ -263,7 +260,7 @@ export default {
|
||||
// the user does indicate a wish to store their info, we
|
||||
// don't want ask them again upon page refresh so move
|
||||
// them instead to a URL which does not always prompt
|
||||
if (storagePrompt === 'true' && checked) {
|
||||
if (storagePrompt === 'true' /* && checked */) {
|
||||
replaceStoragePrompt();
|
||||
return;
|
||||
}
|
||||
@@ -274,19 +271,13 @@ export default {
|
||||
) {
|
||||
emptyStorage();
|
||||
}
|
||||
if (pref && checked) {
|
||||
if (pref /* && checked */) {
|
||||
// Open a URL which won't set storage and won't prompt user about storage
|
||||
replaceStoragePrompt('false');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Reset width/height of dialog (e.g., for use by Export)
|
||||
$('#dialog_container')[0].style.width = oldContainerWidth;
|
||||
$('#dialog_container')[0].style.marginLeft = oldContainerMarginLeft;
|
||||
$('#dialog_content')[0].style.height = oldContentHeight;
|
||||
$('#dialog_container')[0].style.height = oldContainerHeight;
|
||||
|
||||
// It should be enough to (conditionally) add to storage on
|
||||
// beforeunload, but if we wished to update immediately,
|
||||
// we might wish to try setting:
|
||||
|
||||
@@ -63,7 +63,8 @@ export default {
|
||||
} */
|
||||
break;
|
||||
case 'save-end':
|
||||
$.alert(`save complete for pathID ${pathID}!`);
|
||||
// eslint-disable-next-line no-alert
|
||||
alert(`save complete for pathID ${pathID}!`);
|
||||
break;
|
||||
default:
|
||||
throw new Error('Unexpected WebAppFind event type');
|
||||
|
||||
Reference in New Issue
Block a user