Make page rewrite optional
This commit is contained in:
+39
-9
@@ -56,16 +56,46 @@ function movePage() {
|
||||
preselect: parent,
|
||||
hideFiles: true,
|
||||
confirmLabel: 'NEXT',
|
||||
allowRoot: false,
|
||||
onSelect: function (newParent) {
|
||||
promptPageName('Move — new name?', currentName, 'MOVE', function (name) {
|
||||
var dest = (newParent === '/' ? '' : newParent) + '/' + name;
|
||||
var form = document.createElement('form');
|
||||
form.method = 'POST';
|
||||
form.action = window.location.pathname + '?move=' +
|
||||
encodeURIComponent(dest);
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
var input = document.createElement('input');
|
||||
input.type = 'text';
|
||||
input.className = 'modal-input';
|
||||
input.placeholder = 'Page name';
|
||||
input.value = currentName;
|
||||
|
||||
var linksCheckbox = document.createElement('input');
|
||||
linksCheckbox.type = 'checkbox';
|
||||
linksCheckbox.id = 'move-update-links';
|
||||
|
||||
var linksLabel = document.createElement('label');
|
||||
linksLabel.htmlFor = linksCheckbox.id;
|
||||
linksLabel.className = 'modal-checkbox';
|
||||
linksLabel.appendChild(linksCheckbox);
|
||||
linksLabel.appendChild(document.createTextNode('Update links'));
|
||||
|
||||
var body = document.createDocumentFragment();
|
||||
body.appendChild(input);
|
||||
body.appendChild(linksLabel);
|
||||
|
||||
openModal({
|
||||
title: 'Move — new name?',
|
||||
body: body,
|
||||
confirm: {
|
||||
label: 'MOVE',
|
||||
onConfirm: function () {
|
||||
var name = input.value.trim();
|
||||
if (!name) return;
|
||||
var dest = (newParent === '/' ? '' : newParent) + '/' + name;
|
||||
var action = window.location.pathname + '?move=' +
|
||||
encodeURIComponent(dest);
|
||||
if (linksCheckbox.checked) action += '&links=1';
|
||||
var form = document.createElement('form');
|
||||
form.method = 'POST';
|
||||
form.action = action;
|
||||
document.body.appendChild(form);
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -626,6 +626,12 @@ hr {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.modal-checkbox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
/* === Tree picker === */
|
||||
.tree-picker {
|
||||
max-height: 60vh;
|
||||
|
||||
Reference in New Issue
Block a user