mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-14 08:01:19 +08:00
🎨 Support focus block export template https://github.com/siyuan-note/siyuan/issues/8117
This commit is contained in:
parent
1c47a63cca
commit
eddab390d6
@ -526,7 +526,12 @@ export const exportMd = (id: string) => {
|
|||||||
dialog.bindInput(inputElement, () => {
|
dialog.bindInput(inputElement, () => {
|
||||||
(btnsElement[1] as HTMLButtonElement).click();
|
(btnsElement[1] as HTMLButtonElement).click();
|
||||||
});
|
});
|
||||||
inputElement.value = replaceFileName(result.data);
|
let name = replaceFileName(result.data);
|
||||||
|
const maxNameLen = 32;
|
||||||
|
if (name.length > maxNameLen) {
|
||||||
|
name = name.substring(0, maxNameLen);
|
||||||
|
}
|
||||||
|
inputElement.value = name;
|
||||||
inputElement.focus();
|
inputElement.focus();
|
||||||
inputElement.select();
|
inputElement.select();
|
||||||
btnsElement[0].addEventListener("click", () => {
|
btnsElement[0].addEventListener("click", () => {
|
||||||
@ -539,9 +544,13 @@ export const exportMd = (id: string) => {
|
|||||||
inputElement.value = replaceFileName(inputElement.value);
|
inputElement.value = replaceFileName(inputElement.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (name.length > maxNameLen) {
|
||||||
|
name = name.substring(0, maxNameLen);
|
||||||
|
}
|
||||||
|
|
||||||
fetchPost("/api/template/docSaveAsTemplate", {
|
fetchPost("/api/template/docSaveAsTemplate", {
|
||||||
id,
|
id,
|
||||||
name: inputElement.value,
|
name,
|
||||||
overwrite: false
|
overwrite: false
|
||||||
}, response => {
|
}, response => {
|
||||||
if (response.code === 1) {
|
if (response.code === 1) {
|
||||||
@ -549,7 +558,7 @@ export const exportMd = (id: string) => {
|
|||||||
confirmDialog(window.siyuan.languages.export, window.siyuan.languages.exportTplTip, () => {
|
confirmDialog(window.siyuan.languages.export, window.siyuan.languages.exportTplTip, () => {
|
||||||
fetchPost("/api/template/docSaveAsTemplate", {
|
fetchPost("/api/template/docSaveAsTemplate", {
|
||||||
id,
|
id,
|
||||||
name: inputElement.value,
|
name,
|
||||||
overwrite: true
|
overwrite: true
|
||||||
}, resp => {
|
}, resp => {
|
||||||
if (resp.code === 0) {
|
if (resp.code === 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user