Skip to content

Commit

Permalink
fix: Fixes admonition copy button setting inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
valentine195 committed Mar 31, 2022
1 parent 38d54a7 commit 4776da3
Showing 1 changed file with 29 additions and 60 deletions.
89 changes: 29 additions & 60 deletions src/util/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@ export const ADD_COMMAND_NAME = "admonition-add-command";
export const REMOVE_ADMONITION_COMMAND_ICON = `<svg viewBox="0 0 100 100" class="remove-admonition-command"><path fill="currentColor" stroke="currentColor" d="M37,16c-4.4,0-8.3,3.3-9.2,7.6l-11.6,52c-0.5,2.2,0,4.3,1.2,5.9c1.2,1.6,3.2,2.6,5.4,2.6H79c4.4,0,8.3-3.3,9.2-7.6 l11.6-52c0.5-2.2,0-4.3-1.2-5.9C97.4,17,95.4,16,93.2,16L37,16z M37,20h56.2c1.1,0,1.8,0.4,2.2,1c0.5,0.6,0.7,1.4,0.4,2.6l-1,4.4 H30.8l0.8-3.6C32.1,22.2,34.8,20,37,20z M29.9,32H94l-9.6,43.6C83.9,77.8,81.2,80,79,80H22.8c-1.1,0-1.8-0.4-2.2-1 c-0.5-0.6-0.7-1.4-0.4-2.6L29.9,32z M0,36v4h19.6l0.9-4L0,36z M36.7,38c-0.8,0.1-1.4,0.7-1.6,1.5l-3.5,14c-0.2,0.6,0,1.2,0.4,1.7 c0.4,0.5,1,0.8,1.6,0.8H81c0.9,0,1.7-0.6,1.9-1.5l3.5-14c0.2-0.6,0-1.3-0.4-1.8c-0.4-0.5-1-0.8-1.6-0.8H37.1c-0.1,0-0.1,0-0.2,0 C36.9,38,36.8,38,36.7,38L36.7,38z M38.7,42h43.2l-2.4,10H36.2L38.7,42z M0,52v4h16l0.9-4H0z M0,68v4h12.4l0.9-4H0z"></path><circle fill="white" transform="translate(50 50) scale(3 3)" cx="8" cy="8" r="8"/><path fill="#dc3545" transform="translate(50 50) scale(3 3)" d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM4.5 7.5a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1h-7z"/></svg>`;
export const REMOVE_COMMAND_NAME = "admonition-remove-command";

export const COPY_ICON = `<svg fill="currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!-- Font Awesome Pro 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M433.941 65.941l-51.882-51.882A48 48 0 0 0 348.118 0H176c-26.51 0-48 21.49-48 48v48H48c-26.51 0-48 21.49-48 48v320c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48v-48h80c26.51 0 48-21.49 48-48V99.882a48 48 0 0 0-14.059-33.941zM266 464H54a6 6 0 0 1-6-6V150a6 6 0 0 1 6-6h74v224c0 26.51 21.49 48 48 48h96v42a6 6 0 0 1-6 6zm128-96H182a6 6 0 0 1-6-6V54a6 6 0 0 1 6-6h106v88c0 13.255 10.745 24 24 24h88v202a6 6 0 0 1-6 6zm6-256h-64V48h9.632c1.591 0 3.117.632 4.243 1.757l48.368 48.368a6 6 0 0 1 1.757 4.243V112z"/></svg>`;
export const COPY_ICON_NAME = "admonition-copy-content";

export const WARNING_ICON = `<svg fill="currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!-- Font Awesome Pro 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M569.517 440.013C587.975 472.007 564.806 512 527.94 512H48.054c-36.937 0-59.999-40.055-41.577-71.987L246.423 23.985c18.467-32.009 64.72-31.951 83.154 0l239.94 416.028zM288 354c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"/></svg>`;
export const WARNING_ICON_NAME = "admonition-warning";

export const SPIN_ICON = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M304 48C304 74.51 282.5 96 256 96C229.5 96 208 74.51 208 48C208 21.49 229.5 0 256 0C282.5 0 304 21.49 304 48zM304 464C304 490.5 282.5 512 256 512C229.5 512 208 490.5 208 464C208 437.5 229.5 416 256 416C282.5 416 304 437.5 304 464zM0 256C0 229.5 21.49 208 48 208C74.51 208 96 229.5 96 256C96 282.5 74.51 304 48 304C21.49 304 0 282.5 0 256zM512 256C512 282.5 490.5 304 464 304C437.5 304 416 282.5 416 256C416 229.5 437.5 208 464 208C490.5 208 512 229.5 512 256zM74.98 437C56.23 418.3 56.23 387.9 74.98 369.1C93.73 350.4 124.1 350.4 142.9 369.1C161.6 387.9 161.6 418.3 142.9 437C124.1 455.8 93.73 455.8 74.98 437V437zM142.9 142.9C124.1 161.6 93.73 161.6 74.98 142.9C56.24 124.1 56.24 93.73 74.98 74.98C93.73 56.23 124.1 56.23 142.9 74.98C161.6 93.73 161.6 124.1 142.9 142.9zM369.1 369.1C387.9 350.4 418.3 350.4 437 369.1C455.8 387.9 455.8 418.3 437 437C418.3 455.8 387.9 455.8 369.1 437C350.4 418.3 350.4 387.9 369.1 369.1V369.1z"/></svg>`;
export const SPIN_ICON_NAME = 'admonition-spin';
export const SPIN_ICON_NAME = "admonition-spin";

export const ADMONITION_MAP: Record<string, Admonition> = {
note: {
Expand All @@ -25,8 +22,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
seealso: {
type: "note",
Expand All @@ -37,8 +33,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
abstract: {
type: "abstract",
Expand All @@ -49,8 +44,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
summary: {
type: "abstract",
Expand All @@ -61,8 +55,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
tldr: {
type: "abstract",
Expand All @@ -73,8 +66,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
info: {
type: "info",
Expand All @@ -85,8 +77,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
todo: {
type: "info",
Expand All @@ -97,8 +88,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
tip: {
type: "tip",
Expand All @@ -109,8 +99,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
hint: {
type: "tip",
Expand All @@ -121,8 +110,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
important: {
type: "tip",
Expand All @@ -133,8 +121,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
success: {
type: "success",
Expand All @@ -145,8 +132,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
check: {
type: "success",
Expand All @@ -157,8 +143,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
done: {
type: "success",
Expand All @@ -169,8 +154,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
question: {
type: "question",
Expand All @@ -181,8 +165,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
help: {
type: "question",
Expand All @@ -193,8 +176,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
faq: {
type: "question",
Expand All @@ -205,8 +187,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
warning: {
type: "warning",
Expand All @@ -217,8 +198,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
caution: {
type: "warning",
Expand All @@ -229,8 +209,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
attention: {
type: "warning",
Expand All @@ -241,8 +220,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
failure: {
type: "failure",
Expand All @@ -253,8 +231,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
fail: {
type: "failure",
Expand All @@ -265,8 +242,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
missing: {
type: "failure",
Expand All @@ -277,8 +253,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
danger: {
type: "danger",
Expand All @@ -289,8 +264,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
error: {
type: "danger",
Expand All @@ -301,8 +275,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
bug: {
type: "bug",
Expand All @@ -313,8 +286,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
example: {
type: "example",
Expand All @@ -325,8 +297,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
quote: {
type: "quote",
Expand All @@ -337,8 +308,7 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
},
cite: {
type: "quote",
Expand All @@ -349,7 +319,6 @@ export const ADMONITION_MAP: Record<string, Admonition> = {
},
command: false,
injectColor: true,
noTitle: false,
copy: false
noTitle: false
}
};

0 comments on commit 4776da3

Please sign in to comment.