mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 00:20:47 +02:00
This commit is contained in:
parent
ff909fa149
commit
b69fd04137
2 changed files with 11 additions and 2 deletions
|
@ -120,7 +120,8 @@ export const openSnippets = () => {
|
|||
type: target.id === "addCodeSnippetCSS" ? "css" : "js",
|
||||
name: "",
|
||||
content: "",
|
||||
enabled: false
|
||||
enabled: false,
|
||||
disabledInPublish: false,
|
||||
}));
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
@ -195,6 +196,12 @@ const genSnippet = (options: ISnippet) => {
|
|||
<div class="fn__hr--b"></div>
|
||||
<div class="fn__flex">
|
||||
<input type="text" class="fn__size200 b3-text-field" placeholder="${window.siyuan.languages.title}">
|
||||
<div class="fn__space"></div>
|
||||
<label class="fn__flex">
|
||||
<input data-type="disabledInPublish" type="checkbox" class="b3-switch fn__flex-center" ${options.disabledInPublish ? "" : " checked"}>
|
||||
<div class="fn__space"></div>
|
||||
<span class="fn__flex-center">${window.siyuan.languages.publishService}</span>
|
||||
</label>
|
||||
<div class="fn__flex-1"></div>
|
||||
<div class="fn__space"></div>
|
||||
<span aria-label="${window.siyuan.languages.remove}" data-action="remove" class="b3-tooltips b3-tooltips__sw block__icon block__icon--show">
|
||||
|
@ -229,11 +236,12 @@ const setSnippet = (dialog: Dialog, oldSnippets: ISnippet[], removeIds: string[]
|
|||
const snippets: ISnippet[] = [];
|
||||
dialog.element.querySelectorAll("[data-id]").forEach((item) => {
|
||||
snippets.push({
|
||||
disabledInPublish: !(item.querySelector('.b3-switch[data-type="disabledInPublish"]') as HTMLInputElement).checked,
|
||||
id: item.getAttribute("data-id"),
|
||||
name: item.querySelector("input").value,
|
||||
type: item.getAttribute("data-type"),
|
||||
content: item.querySelector("textarea").value,
|
||||
enabled: (item.querySelector(".b3-switch") as HTMLInputElement).checked
|
||||
enabled: (item.querySelector('.b3-switch[data-type="snippet"]') as HTMLInputElement).checked
|
||||
});
|
||||
});
|
||||
if (objEquals(oldSnippets, snippets) &&
|
||||
|
|
1
app/src/types/index.d.ts
vendored
1
app/src/types/index.d.ts
vendored
|
@ -369,6 +369,7 @@ interface ISnippet {
|
|||
type: string;
|
||||
enabled: boolean;
|
||||
content: string;
|
||||
disabledInPublish: boolean;
|
||||
}
|
||||
|
||||
interface IInbox {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue