add: template editor format buttons

This commit is contained in:
windingwind 2024-10-13 10:45:49 +02:00
parent 196df9a915
commit 314f3a0811
33 changed files with 679 additions and 340 deletions

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="a" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
<polygon
points="3.43 9.96 3.43 16.46 6.78 16.46 6.78 15.21 4.68 15.21 4.68 4.79 6.78 4.79 6.78 3.54 3.43 3.54 3.43 9.96"
style="stroke-width: 0px;" fill="currentColor" />
<polygon
points="16.57 10.04 16.57 3.54 13.22 3.54 13.22 4.79 15.32 4.79 15.32 15.21 13.22 15.21 13.22 16.46 16.57 16.46 16.57 10.04"
style="stroke-width: 0px;" fill="currentColor" />
<path
d="m6.23,12.33c0-.38.12-.69.36-.9.24-.22.5-.32.8-.32.21,0,.4.07.55.2.15.13.23.31.23.54,0,.51-.27.87-.81,1.07.2.17.42.26.65.26.4,0,.72-.24.96-.73.15-.27.39-1.07.71-2.4.33-1.34.49-2.13.49-2.37,0-.28-.08-.48-.24-.6-.16-.12-.35-.18-.56-.18-.4,0-.78.17-1.16.5-.38.33-.66.75-.84,1.25-.06.19-.12.31-.17.36-.05.05-.15.08-.3.09h-.08c-.28,0-.41-.08-.41-.25,0-.13.06-.33.19-.59.13-.26.31-.54.54-.84.23-.3.56-.56.98-.78.42-.22.86-.33,1.34-.33.88,0,1.53.29,1.97.87.55-.58,1.1-.87,1.65-.87.46,0,.86.13,1.21.38.35.26.53.61.53,1.05,0,.39-.12.69-.36.91s-.5.33-.8.33c-.22,0-.41-.07-.56-.21-.15-.14-.22-.32-.22-.54,0-.51.27-.87.82-1.07-.2-.17-.42-.26-.66-.26-.15,0-.29.03-.42.09s-.25.18-.35.35c-.11.17-.2.33-.27.49-.08.15-.16.39-.25.7-.09.31-.16.57-.21.79-.05.21-.13.53-.23.96-.1.43-.18.76-.25,1.01-.13.51-.2.88-.2,1.12,0,.28.08.48.25.6.17.12.36.19.57.19.4,0,.78-.17,1.16-.5.38-.33.66-.74.84-1.23.01-.02.02-.05.03-.1.01-.04.02-.07.03-.09s.02-.04.03-.07.02-.05.02-.06c0,0,.02-.03.03-.05s.03-.04.05-.04c.02,0,.04-.01.06-.02.02,0,.05-.02.07-.02h.2c.28,0,.41.08.41.24,0,.4-.29.92-.88,1.56-.59.65-1.31.97-2.16.97-.93,0-1.59-.29-2-.87h-.02c-.47.58-1.01.87-1.63.87-.45,0-.85-.13-1.2-.38-.35-.25-.53-.6-.53-1.05Z"
style="stroke-width: 0px;" fill="currentColor" />
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,6 @@
<svg t="1728768259016" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4687"
width="20" height="20">
<path
d="M181.333333 509.866667v332.8H352.64v-64H245.333333V245.333333h107.306667v-64H181.333333v328.533334z m672.597334 4.266666v-332.8H682.666667v64h107.306666v533.333334H682.666667v64H853.930667v-328.533334z m-397.568 223.061334l85.930666-214.826667 84.736-211.84-59.434666-23.765333-84.693334 211.84-85.930666 214.826666 59.392 23.765334z"
fill="currentColor" p-id="4688"></path>
</svg>

After

Width:  |  Height:  |  Size: 559 B

View File

@ -0,0 +1,3 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M4 8V4.5V2H7.5H12C13.933 2 15.5 3.567 15.5 5.5C15.5 7.433 13.933 9 12 9C14.2091 9 16 10.7909 16 13C16 15.2091 14.2091 17 12 17H7.5H4V14.5V10.5V8ZM7.5 10.5V14.5H10.5C11.6046 14.5 12.5 13.6046 12.5 12.5C12.5 11.3954 11.6046 10.5 10.5 10.5H7.5ZM7.5 8V4.5H10.25C11.2165 4.5 12 5.2835 12 6.25C12 7.2165 11.2165 8 10.25 8H7.5Z" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 496 B

View File

@ -0,0 +1,6 @@
<svg t="1728768172242" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4279"
width="20" height="20">
<path
d="M256 426.666667a85.333333 85.333333 0 1 0 0-170.666667 85.333333 85.333333 0 0 0 0 170.666667z m597.333333-53.333334h-379.264v-64H853.333333v64z m0 298.666667h-379.264v-64H853.333333v64zM341.333333 640a85.333333 85.333333 0 1 1-170.666666 0 85.333333 85.333333 0 0 1 170.666666 0z"
fill="currentColor" p-id="4280"></path>
</svg>

After

Width:  |  Height:  |  Size: 506 B

View File

@ -0,0 +1,6 @@
<svg t="1728768054402" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3427"
width="20" height="20">
<path
d="M170.666667 170.666667h682.666666v64H170.666667V170.666667z m597.333333 234.666666H256a21.333333 21.333333 0 0 0-21.333333 21.333334v170.666666a21.333333 21.333333 0 0 0 21.333333 21.333334h512a21.333333 21.333333 0 0 0 21.333333-21.333334v-170.666666a21.333333 21.333333 0 0 0-21.333333-21.333334zM256 341.333333h512a85.333333 85.333333 0 0 1 85.333333 85.333334v170.666666a85.333333 85.333333 0 0 1-85.333333 85.333334H256a85.333333 85.333333 0 0 1-85.333333-85.333334v-170.666666a85.333333 85.333333 0 0 1 85.333333-85.333334z m597.333333 448H170.666667V853.333333h682.666666v-64z"
fill="currentColor" p-id="3428"></path>
</svg>

After

Width:  |  Height:  |  Size: 809 B

View File

@ -0,0 +1,6 @@
<svg t="1728768084775" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3633"
width="20" height="20">
<path
d="M469.333333 298.666667h85.333334v426.666666h-85.333334v-170.666666H298.666667v170.666666H213.333333V298.666667h85.333334v170.666666h170.666666V298.666667z m281.6 0c-25.6 38.4-64 72.533333-110.933333 85.333333v42.666667h85.333333v298.666666h85.333334V298.666667h-59.733334z"
fill="currentColor" p-id="3634"></path>
</svg>

After

Width:  |  Height:  |  Size: 498 B

View File

@ -0,0 +1,6 @@
<svg t="1728768115138" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3879"
width="20" height="20">
<path
d="M384 302.933333h85.333333v426.666667H384v-170.666667H213.333333v170.666667H128v-426.666667h85.333333v170.666667h170.666667v-170.666667z m341.333333 341.333334c21.333333-17.066667 25.6-25.6 46.933334-46.933334 17.066667-17.066667 34.133333-34.133333 51.2-55.466666 12.8-17.066667 25.6-34.133333 38.4-55.466667 8.533333-17.066667 12.8-34.133333 12.8-55.466667 0-17.066667-4.266667-38.4-12.8-55.466666-8.533333-17.066667-17.066667-29.866667-34.133334-42.666667-12.8-12.8-29.866667-21.333333-51.2-25.6-21.333333-8.533333-42.666667-8.533333-64-8.533333-17.066667 0-29.866667 0-46.933333 4.266666-12.8 4.266667-29.866667 8.533333-42.666667 12.8-12.8 4.266667-25.6 12.8-38.4 21.333334-12.8 8.533333-25.6 17.066667-34.133333 29.866666l51.2 51.2c12.8-12.8 25.6-21.333333 42.666667-29.866666 17.066667-8.533333 29.866667-12.8 51.2-12.8s38.4 4.266667 55.466666 17.066666c12.8 12.8 21.333333 29.866667 21.333334 46.933334 0 17.066667-4.266667 34.133333-17.066667 46.933333-12.8 21.333333-25.6 38.4-42.666667 51.2-17.066667 17.066667-42.666667 38.4-68.266666 59.733333-25.6 21.333333-59.733333 46.933333-93.866667 68.266667v64h341.333333v-85.333333H725.333333z"
fill="currentColor" p-id="3880"></path>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,6 @@
<svg t="1728768147139" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4077"
width="20" height="20">
<path
d="M601.6 605.866667c17.066667 12.8 34.133333 21.333333 51.2 29.866666 17.066667 8.533333 38.4 12.8 59.733333 12.8 21.333333 0 42.666667-4.266667 59.733334-12.8 12.8-4.266667 21.333333-21.333333 21.333333-34.133333 0-8.533333 0-17.066667-4.266667-25.6-4.266667-8.533333-12.8-12.8-21.333333-17.066667-12.8-4.266667-29.866667-8.533333-42.666667-12.8-21.333333-4.266667-42.666667-4.266667-64-4.266666v-68.266667c29.866667 4.266667 64-4.266667 93.866667-17.066667 17.066667-8.533333 25.6-21.333333 25.6-38.4 0-12.8-4.266667-25.6-17.066667-34.133333-12.8-8.533333-29.866667-12.8-46.933333-12.8-17.066667 0-34.133333 4.266667-46.933333 12.8-17.066667 8.533333-29.866667 17.066667-46.933334 25.6l-51.2-59.733333c21.333333-17.066667 46.933333-29.866667 68.266667-38.4 21.333333-8.533333 51.2-12.8 76.8-12.8 21.333333 0 42.666667 4.266667 68.266667 8.533333 17.066667 4.266667 34.133333 12.8 51.2 21.333333 12.8 8.533333 25.6 21.333333 34.133333 34.133334 8.533333 12.8 12.8 29.866667 12.8 46.933333 0 21.333333-8.533333 38.4-21.333333 55.466667-17.066667 17.066667-38.4 29.866667-64 38.4v4.266666c25.6 4.266667 51.2 17.066667 68.266666 34.133334 17.066667 17.066667 29.866667 38.4 29.866667 64 0 17.066667-4.266667 34.133333-12.8 51.2-8.533333 17.066667-21.333333 29.866667-38.4 38.4-17.066667 12.8-38.4 17.066667-55.466667 21.333333-21.333333 4.266667-42.666667 8.533333-68.266666 8.533333-34.133333 0-68.266667-4.266667-98.133334-17.066666-25.6-8.533333-46.933333-25.6-68.266666-42.666667l46.933333-59.733333zM384 469.333333H213.333333V298.666667H128v426.666666h85.333333v-170.666666h170.666667v170.666666h85.333333V298.666667H384v170.666666z"
fill="currentColor" p-id="4078"></path>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="a" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
<path d="m6.12,16l.88-.88L1.88,10l5.12-5.12-.88-.88L.12,10l6,6Zm7.77,0l-.88-.88,5.12-5.12-5.12-5.12.88-.88,6,6-6,6Z"
style="fill-rule: evenodd; stroke-width: 0px;" fill="currentColor" />
<path
d="m6.23,12.33c0-.39.12-.69.36-.9s.5-.32.8-.32c.21,0,.4.07.55.2s.23.31.23.54c0,.51-.27.87-.81,1.07.2.17.42.26.65.26.4,0,.72-.25.96-.73.15-.27.39-1.07.71-2.4s.49-2.13.49-2.37c0-.28-.08-.48-.24-.6s-.34-.18-.56-.18c-.4,0-.78.17-1.16.5s-.66.75-.84,1.25c-.06.19-.12.31-.17.36s-.15.08-.3.09h-.08c-.28,0-.41-.08-.41-.25,0-.13.06-.33.19-.59s.31-.54.54-.84.56-.56.98-.78.86-.33,1.34-.33c.88,0,1.53.29,1.97.87.55-.58,1.1-.87,1.65-.87.46,0,.86.13,1.21.38s.53.61.53,1.05c0,.39-.12.69-.36.91s-.5.33-.8.33c-.22,0-.41-.07-.56-.21s-.22-.32-.22-.54c0-.51.27-.87.82-1.07-.2-.17-.42-.26-.66-.26-.15,0-.29.03-.42.09s-.25.18-.35.35-.2.33-.27.49-.16.39-.25.7-.16.57-.21.79-.13.53-.23.96-.18.76-.25,1.01c-.13.51-.2.88-.2,1.12,0,.28.08.48.25.6s.36.19.57.19c.4,0,.78-.17,1.16-.5s.66-.74.84-1.23c.01-.02.02-.05.03-.1s.02-.07.03-.09.02-.04.03-.07.02-.05.02-.06.02-.03.03-.05.03-.04.05-.04.04-.01.06-.02.05-.02.07-.02h.2c.28,0,.41.08.41.24,0,.4-.29.92-.88,1.56s-1.31.97-2.16.97c-.93,0-1.59-.29-2-.87h-.02c-.47.58-1.01.87-1.63.87-.45,0-.85-.13-1.2-.38-.35-.25-.53-.6-.53-1.05Z"
style="stroke-width: 0px;" fill="currentColor" />
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="a" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
<path d="m6.12,16l.88-.88L1.88,10l5.12-5.12-.88-.88L.12,10l6,6Zm7.77,0l-.88-.88,5.12-5.12-5.12-5.12.88-.88,6,6-6,6Z"
style="fill-rule: evenodd; stroke-width: 0px;" fill="currentColor" />
<polygon points="8.91 14.4 10.59 10.2 12.25 6.07 11.09 5.6 9.43 9.74 7.75 13.93 8.91 14.4" style="stroke-width: 0px;"
fill="currentColor" />
</svg>

After

Width:  |  Height:  |  Size: 476 B

View File

@ -0,0 +1,3 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7 2H15V4H12.0164L11.9839 4.17889L10.0164 15H13V17H5V15H7.98361L8.01613 14.8211L9.98361 4H7V2Z" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 270 B

View File

@ -0,0 +1,10 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_1132_37385)">
<path fill-rule="evenodd" clip-rule="evenodd" d="M0 8.125C0 5.70875 1.95875 3.75 4.375 3.75H9.625C12.0412 3.75 14 5.70875 14 8.125C14 10.5412 12.0412 12.5 9.625 12.5H8.60669C8.5376 12.3045 8.5 12.0941 8.5 11.875C8.5 11.6559 8.5376 11.4455 8.60669 11.25H9.625C11.3509 11.25 12.75 9.85089 12.75 8.125C12.75 6.39911 11.3509 5 9.625 5H4.375C2.64911 5 1.25 6.39911 1.25 8.125C1.25 9.85089 2.64911 11.25 4.375 11.25H4.78433C4.76165 11.4552 4.75 11.6637 4.75 11.875C4.75 12.0863 4.76165 12.2948 4.78433 12.5H4.375C1.95875 12.5 0 10.5412 0 8.125ZM10.3751 7.49999H11.3934C11.4625 7.69547 11.5001 7.90584 11.5001 8.12499C11.5001 8.34413 11.4625 8.5545 11.3934 8.74999H10.3751C8.64919 8.74999 7.25008 10.1491 7.25008 11.875C7.25008 13.6009 8.64919 15 10.3751 15H15.6251C17.351 15 18.7501 13.6009 18.7501 11.875C18.7501 10.1491 17.351 8.74999 15.6251 8.74999H15.2157C15.2384 8.54478 15.2501 8.33624 15.2501 8.12499C15.2501 7.91373 15.2384 7.7052 15.2157 7.49999H15.6251C18.0413 7.49999 20.0001 9.45874 20.0001 11.875C20.0001 14.2912 18.0413 16.25 15.6251 16.25H10.3751C7.95883 16.25 6.00008 14.2912 6.00008 11.875C6.00008 9.45874 7.95883 7.49999 10.3751 7.49999Z" fill="currentColor"/>
</g>
<defs>
<clipPath id="clip0_1132_37385">
<rect width="20" height="20" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,10 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_6179_36208)">
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.0971 9L11.0138 9.50002L9.99326 15.6224C9.62633 17.8241 7.5441 19.3114 5.34247 18.9444C4.24166 18.761 3.31942 18.1487 2.71826 17.307L4.34573 16.1446C4.64939 16.5697 5.11523 16.879 5.67127 16.9716C6.78335 17.157 7.83513 16.4057 8.02048 15.2936L8.98619 9.50002L9.06953 9H4.99999V7H9.40286L10.0066 3.37761C10.3735 1.17599 12.4558 -0.311319 14.6574 0.055618C15.7582 0.239087 16.6804 0.851379 17.2816 1.69301L15.6541 2.85548C15.3505 2.43036 14.8846 2.12108 14.3286 2.02841C13.2165 1.84306 12.1647 2.59433 11.9794 3.70641L11.4305 7H16V9H11.0971Z" fill="currentColor"/>
</g>
<defs>
<clipPath id="clip0_6179_36208">
<rect width="20" height="20" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 866 B

View File

@ -0,0 +1,3 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.11621 16L7.00009 15.1161L1.88398 10L7.00009 4.88388L6.11621 4L0.116211 10L6.11621 16ZM13.884 16L13.0001 15.1161L18.1162 10L13.0001 4.88388L13.884 4L19.884 10L13.884 16Z" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 347 B

View File

@ -0,0 +1,6 @@
<svg t="1728768200791" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4481"
width="20" height="20">
<path
d="M256 226.389333V426.666667H213.333333V285.610667l-35.925333 11.946666-13.482667-40.448 64-21.333333 28.074667-9.386667zM853.333333 373.333333h-379.264v-64H853.333333v64z m0 298.666667h-379.264v-64H853.333333v64zM194.730667 530.688c20.565333-6.101333 52.437333-10.410667 72.618666 15.658667 10.794667 13.952 12.202667 31.829333 9.984 46.506666-3.242667 21.418667-17.194667 47.914667-28.928 70.186667-3.712 7.082667-7.253333 13.738667-10.069333 19.626667H277.333333v42.666666H162.816c10.794667-18.645333 20.778667-35.712 30.592-52.522666l31.274667-53.802667c5.376-9.386667 15.786667-33.450667 6.826666-45.013333-3.84-4.949333-13.994667-10.325333-28.501333-5.973334-13.141333 3.84-24.874667 14.378667-33.024 21.674667l-0.298667 0.256-5.546666-46.165333c8.96-4.864 19.626667-9.813333 30.592-13.098667z"
fill="currentColor" p-id="4482"></path>
</svg>

After

Width:  |  Height:  |  Size: 1023 B

View File

@ -0,0 +1,6 @@
<svg t="1728767929805" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3225"
width="20" height="20">
<path
d="M170.666667 373.333333h682.666666v-64H170.666667v64z m341.333333 298.666667h341.333333v-64h-341.333333v64z m-342.613333 105.386667l126.72-126.72-126.72-126.72 45.226666-45.226667 149.333334 149.333333 22.613333 22.613334-22.613333 22.613333-149.333334 149.333333-45.226666-45.226666z"
fill="currentColor" p-id="3226"></path>
</svg>

After

Width:  |  Height:  |  Size: 509 B

View File

@ -0,0 +1,3 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M10 2C8.85166 2 7.64614 2.28406 6.6953 2.91795C5.71482 3.5716 5 4.61209 5 6C5 6.77149 5.16552 7.44802 5.49725 8.02784C5.71987 8.41695 6.00217 8.73606 6.31739 9H2V10.25H9.10026C9.38748 10.3245 9.66916 10.3907 9.93645 10.4535L9.93646 10.4536L10.021 10.4734C11.1302 10.7344 12.0126 10.9532 12.6404 11.3471C12.9309 11.5294 13.1326 11.7308 13.2668 11.9653C13.3999 12.198 13.5 12.5215 13.5 13C13.5 13.9401 13.1463 14.4997 12.6183 14.8653C12.0364 15.2682 11.1404 15.5 10 15.5C7.79256 15.5 6.5 14.2197 6.5 13H4.5C4.5 15.7803 7.20744 17.5 10 17.5C11.3596 17.5 12.7136 17.2318 13.7567 16.5097C14.8537 15.7503 15.5 14.5599 15.5 13C15.5 12.2285 15.3345 11.552 15.0028 10.9722C14.8462 10.6985 14.6602 10.4595 14.4539 10.25H18V9H12.2582C11.6828 8.80946 11.0947 8.67127 10.5635 8.54645L10.5635 8.54645L10.479 8.52658C9.36982 8.26559 8.48741 8.04685 7.85962 7.65294C7.56905 7.47062 7.36738 7.26916 7.23322 7.03466C7.1001 6.80198 7 6.47851 7 6C7 5.38791 7.28518 4.9284 7.8047 4.58205C8.35386 4.21594 9.14834 4 10 4C10.8517 4 11.6461 4.21594 12.1953 4.58205C12.7148 4.9284 13 5.38791 13 6H15C15 4.61209 14.2852 3.5716 13.3047 2.91795C12.3539 2.28406 11.1483 2 10 2Z" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,3 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.809 9.5L1.95605 2H4.33823L8.00008 7.65923L11.6619 2H14.0441L9.19117 9.5L14.0441 17H11.6619L8.00008 11.3408L4.33823 17H1.95605L6.809 9.5ZM17.4697 15.2197L15 17.6893V19H15.5H20V17.5H17.3107L18.5303 16.2803C19.3008 15.5099 20 14.5711 20 13.5C20 12.9749 19.8289 12.3634 19.4242 11.8688C19.0004 11.3508 18.3498 11 17.5 11C16.6502 11 15.9996 11.3508 15.5758 11.8688C15.1711 12.3634 15 12.9749 15 13.5H16.5C16.5 13.2751 16.5789 13.0116 16.7367 12.8187C16.8754 12.6492 17.0998 12.5 17.5 12.5C17.9002 12.5 18.1246 12.6492 18.2633 12.8187C18.4211 13.0116 18.5 13.2751 18.5 13.5C18.5 13.9289 18.1992 14.4901 17.4697 15.2197Z" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 792 B

View File

@ -0,0 +1,3 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M17.4697 4.21967L15 6.68934V8H15.5H20V6.5H17.3107L18.5303 5.28033C19.3008 4.50988 20 3.57109 20 2.5C20 1.97495 19.8289 1.36341 19.4242 0.868822C19.0004 0.350834 18.3498 0 17.5 0C16.6502 0 15.9996 0.350834 15.5758 0.868822C15.1711 1.36341 15 1.97495 15 2.5H16.5C16.5 2.27505 16.5789 2.01159 16.7367 1.81868C16.8754 1.64917 17.0998 1.5 17.5 1.5C17.9002 1.5 18.1246 1.64917 18.2633 1.81868C18.4211 2.01159 18.5 2.27505 18.5 2.5C18.5 2.92891 18.1992 3.49012 17.4697 4.21967ZM6.809 9.5L1.95605 2H4.33823L8.00008 7.65923L11.6619 2H14.0441L9.19117 9.5L14.0441 17H11.6619L8.00008 11.3408L4.33823 17H1.95605L6.809 9.5Z" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 785 B

View File

@ -0,0 +1,3 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.75 3.25V6.75H3.25V3.25H16.75ZM3.25 8H7V11.75H3.25V8ZM8.25 11.75V8H11.75V11.75H8.25ZM11.75 13H8.25V16.75H11.75V13ZM13 16.75V13H16.75V16.75H13ZM13 11.75V8H16.75V11.75H13ZM3.25 13H7V16.75H3.25V13ZM18 2H2V18H18V2Z" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 389 B

View File

@ -0,0 +1,3 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M16 14L11 2H9L4 14H6.16667L7.41667 11H12.5833L13.8333 14H16ZM10 4.8L8.04167 9.5H11.9583L10 4.8ZM2.25 17.75V16.25H17.75V17.75H2.25ZM1 15H2.25H17.75H19V16.25V17.75V19H17.75H2.25H1V17.75V16.25V15Z" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 369 B

View File

@ -0,0 +1,3 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 2H4V11C4 14.5836 6.71815 17 10 17C13.2819 17 16 14.5836 16 11V2H14V11C14 13.4164 12.241 15 10 15C7.75901 15 6 13.4164 6 11V2ZM4 19V17.75H16V19H4Z" fill="currentColor"/>
</svg>

After

Width:  |  Height:  |  Size: 324 B

View File

@ -560,10 +560,10 @@
margin-bottom: 0 !important;
}
.markdown-body a:not([href]) {
/* .markdown-body a:not([href]) {
color: inherit;
text-decoration: none;
}
} */
.markdown-body .absent {
color: var(--color-danger-fg);

View File

@ -0,0 +1,133 @@
html,
body {
min-width: 600px;
min-height: 400px;
}
html,
body,
.viewport {
padding: 0;
margin: 0;
height: 100%;
word-wrap: break-word;
}
.viewport {
flex-grow: 1;
flex-shrink: 1;
margin: 0 5px 0 5px;
overflow-x: hidden;
overflow-y: auto;
}
.viewport-container {
padding: 0;
margin: 0;
height: calc(100% - 50px);
width: 100%;
display: flex;
flex-direction: row;
overflow: hidden;
border-bottom: var(--material-border);
background: var(--material-background);
}
.footer-container {
padding: 5px;
}
.list-viewport {
width: calc(30% - 10px);
height: 100%;
overflow: hidden;
}
#table-container {
height: 100%;
width: 100%;
overflow: auto;
}
#templates-table {
height: 100%;
}
.editor-viewport {
display: flex;
flex-direction: column;
width: calc(40% - 10px);
padding: 5px;
}
.preview-viewport {
display: flex;
flex-direction: column;
width: calc(30% - 10px);
padding: 5px;
}
.markdown-body {
box-sizing: border-box;
min-width: 200px;
max-width: 980px;
margin: 0 auto;
padding: 0px;
}
.help-button {
appearance: auto;
-moz-default-appearance: -moz-mac-help-button;
min-width: 0;
}
.editor-button-container {
display: flex;
flex-wrap: wrap;
gap: 4px;
padding: 4px;
}
.editor-button-container[hidden] {
display: none;
}
.format {
width: 28px;
height: 28px;
border-radius: 5px;
flex-grow: 0;
flex-shrink: 0;
margin: 0;
background-repeat: no-repeat;
background-position: center;
}
.format:hover {
background-color: var(--fill-quinary);
}
.format:active {
background-color: var(--fill-quarternary);
}
.snippet {
border: var(--material-panedivider);
border-radius: 4px;
cursor: pointer;
font-size: 0.916666667em;
line-height: 1.272727273;
overflow: hidden;
padding: 1px 4px;
text-overflow: ellipsis;
white-space: pre;
box-sizing: border-box;
color: var(--fill-primary);
}
.snippet.syntax {
background-color: color-mix(
in srgb,
var(--accent-yellow) 50%,
transparent 50%
);
}
.snippet.expression {
background-color: color-mix(
in srgb,
var(--accent-green) 50%,
transparent 50%
);
}
.snippet.variable {
background-color: color-mix(
in srgb,
var(--accent-azure) 50%,
transparent 50%
);
}
.snippet:hover {
background-color: var(--fill-quinary);
}

View File

@ -61,127 +61,18 @@
window.arguments[0]._initPromise.resolve();
});
</script>
<style>
html,
body {
min-width: 600px;
min-height: 400px;
}
html,
body,
.viewport {
padding: 0;
margin: 0;
height: 100%;
word-wrap: break-word;
}
.viewport {
flex-grow: 1;
flex-shrink: 1;
margin: 0 5px 0 5px;
overflow-x: hidden;
overflow-y: auto;
}
.viewport-container {
padding: 0;
margin: 0;
height: calc(100% - 50px);
width: 100%;
display: flex;
flex-direction: row;
overflow: hidden;
border-bottom: var(--material-border);
background: var(--material-background);
}
.footer-container {
padding: 5px;
}
.list-viewport {
width: calc(30% - 10px);
height: 100%;
overflow: hidden;
}
#table-container {
height: 100%;
width: 100%;
overflow: auto;
}
#templates-table {
height: 100%;
}
.editor-viewport {
display: flex;
flex-direction: column;
width: calc(40% - 10px);
padding: 5px;
}
.preview-viewport {
display: flex;
flex-direction: column;
width: calc(30% - 10px);
padding: 5px;
}
.markdown-body {
box-sizing: border-box;
min-width: 200px;
max-width: 980px;
margin: 0 auto;
padding: 0px;
}
.help-button {
appearance: auto;
-moz-default-appearance: -moz-mac-help-button;
min-width: 0;
}
#snippets-container {
display: flex;
flex-wrap: wrap;
gap: 4px;
padding: 4px;
}
.snippet {
border: var(--material-panedivider);
border-radius: 4px;
cursor: pointer;
font-size: 0.916666667em;
line-height: 1.272727273;
overflow: hidden;
padding: 1px 4px;
text-overflow: ellipsis;
white-space: pre;
box-sizing: border-box;
color: var(--fill-primary);
}
.snippet.syntax {
background-color: color-mix(
in srgb,
var(--accent-yellow) 50%,
transparent 50%
);
}
.snippet.expression {
background-color: color-mix(
in srgb,
var(--accent-green) 50%,
transparent 50%
);
}
.snippet.variable {
background-color: color-mix(
in srgb,
var(--accent-azure) 50%,
transparent 50%
);
}
.snippet:hover {
background-color: var(--fill-quinary);
}
</style>
<link
rel="stylesheet"
type="text/css"
href="chrome://__addonRef__/content/lib/css/github-markdown.css"
/>
<link
rel="stylesheet"
href="chrome://__addonRef__/content/lib/css/katex.min.css"
/>
<link
rel="stylesheet"
href="chrome://__addonRef__/content/styles/templateEditor.css"
/>
</head>
<body class="zotero-window">
<div class="viewport-container">
@ -227,6 +118,7 @@
<div style="flex-shrink: 0" data-l10n-id="templateName"></div>
<input id="editor-name" type="text" style="width: 100%" />
</xul:hbox>
<div id="formats-container" class="editor-button-container"></div>
<div style="display: flex; flex-direction: column; height: 100%">
<iframe
id="editor"
@ -235,7 +127,7 @@
onmousedown="this.focus()"
></iframe>
</div>
<div id="snippets-container"></div>
<div id="snippets-container" class="editor-button-container"></div>
</xul:hbox>
<xul:splitter
state="open"

View File

@ -45,36 +45,53 @@ restore =
help =
.label = Help
format-bold =
.title = Bold
format-italic =
.title = Italic
format-strikethrough =
.title = Strike-through
format-underline =
.title = Underline
format-superscript =
.title = Superscript
format-subscript =
.title = Subscript
format-textColor =
.title = Text color
format-link =
.title = Link
format-quote =
.title = Quote
format-monospaced =
.title = Monospace
format-code =
.title = Code block
format-table =
.title = Table
format-h1 =
.title = Level 1 heading
format-h2 =
.title = Level 2 heading
format-h3 =
.title = Level 3 heading
format-bullet =
.title = Bullet list
format-numbered =
.title = Numbered list
format-inlineMath =
.title = Inline math formula
format-blockMath =
.title = Multi-line math formula
format-inlineScript =
.title = Add an inline JS script, the result of which will be embedded in the note
format-blockScript =
.title = Add a multi-line async JS script, the return value of which will be embedded in the note
snippet-useMarkdown = use markdown
.title = Parse the template as markdown
snippet-useRefresh = use refresh
.title = Allow the content generated by the template to be refreshed
snippet-inlineScript = inline script
.title = Add an inline JS script, the result of which will be embedded in the note
snippet-multiLineScript = multi-line script
.title = Add a multi-line async JS script, the return value of which will be embedded in the note
snippet-markdownHeading1 = heading 1
.title = Markdown heading 1, type `#` at the beginning of the line followed by your heading. Should be used in markdown mode
snippet-markdownHeading2 = heading 2
.title = Markdown heading 2, type `##` at the beginning of the line followed by your heading. Should be used in markdown mode
snippet-markdownHeading3 = heading 3
.title = Markdown heading 3, type `###` at the beginning of the line followed by your heading. Should be used in markdown mode
snippet-markdownBullet = bullet list
.title = Markdown bullet list, type `-` at the beginning of the line followed by your list item. Should be used in markdown mode
snippet-markdownNumber = number list
.title = Markdown number list, type `1.` at the beginning of the line followed by your list item. Should be used in markdown mode
snippet-markdownBold = bold text
.title = Markdown bold text, type `**` at the beginning and end of your text. Should be used in markdown mode
snippet-markdownItalic = italic text
.title = Markdown italic text, type `_` at the beginning and end of your text. Should be used in markdown mode
snippet-markdownLink = link
.title = Markdown link, type `[` at the beginning and `](url)` at the end of your text. Should be used in markdown mode
snippet-markdownMonospace = monospace text
.title = Markdown monospace text, type ` at the beginning and end of your text. Should be used in markdown mode
snippet-markdownQuote = quote
.title = Markdown quote, type `>` at the beginning of the line followed by your quote. Should be used in markdown mode
snippet-markdownTable = table
.title = Markdown table, type `|` to separate columns and rows. Should be used in markdown mode
snippet-dryRunFlag = dry run flag
.title = Check if the template is running in dry run mode, e.g. for preview. In dry run mode, the script should not have side effects.
snippet-itemBeforeLoop = before loop

View File

@ -45,36 +45,53 @@ restore =
help =
.label = Aiuto
format-bold =
.title = Grassetto
format-italic =
.title = Corsivo
format-strikethrough =
.title = Barrato
format-underline =
.title = Sottolineato
format-superscript =
.title = Apice
format-subscript =
.title = Pedice
format-textColor =
.title = Colore del testo
format-link =
.title = Link
format-quote =
.title = Citazione
format-monospaced =
.title = Testo monospaziato
format-code =
.title = Codice
format-table =
.title = Tabella
format-h1 =
.title = Intestazione di livello 1
format-h2 =
.title = Intestazione di livello 2
format-h3 =
.title = Intestazione di livello 3
format-bullet =
.title = Elenco puntato
format-numbered =
.title = Elenco numerato
format-inlineMath =
.title = Formula matematica in linea
format-blockMath =
.title = Formula matematica multilinea
format-inlineScript =
.title = Aggiungi uno script JS in-linea, e inserisci il risultato nella nota
format-blockScript =
.title = Aggiungi uno script JS multi-linea, e inserisci il valore risultante nella nota
snippet-useMarkdown = usa markdown
.title = Elabora il template come markdown
snippet-useRefresh = abilita aggiornamento
.title = Permetti al contenuto generato dal template di essere aggiornato
snippet-inlineScript = script in-linea
.title = Aggiungi uno script JS in-linea, e inserisci il risultato nella nota
snippet-multiLineScript = script multi-linea
.title = Aggiungi uno script JS multi-linea, e inserisci il valore risultante nella nota
snippet-markdownHeading1 = intestazione 1
.title = Intestazione 1 Markdown, digita `#` a inizio riga seguito dall'intestazione. Da usare in modalità markdown
snippet-markdownHeading2 = intestazione 2
.title = Intestazione 2 Markdown, digita `##` a inizio riga seguito dall'intestazione. Da usare in modalità markdown
snippet-markdownHeading3 = intestazione 3
.title = Intestazione 3 Markdown, digita `###` a inizio riga seguito dall'intestazione. Da usare in modalità markdown
snippet-markdownBullet = elenco puntato
.title = Elenco puntato Markdown, digita `-` a inizio riga seguito dalla voce elenco. Da usare in modalità markdown
snippet-markdownNumber = elenco numerato
.title = Elenco numerato Markdown, digita `1.` a inizio riga seguito dalla voce elenco. Da usare in modalità markdown
snippet-markdownBold = grassetto
.title = Grassetto Markdown, digita `**` a inizio e alla fine del testo. Da usare in modalità markdown
snippet-markdownItalic = corsivo
.title = Corsivo Markdown, digita `_` a inizio e alla fine del testo. Da usare in modalità markdown
snippet-markdownLink = link
.title = Link Markdown, digita `[` all'inizio e `](url)` alla fine del testo. Da usare in modalità markdown
snippet-markdownMonospace = testo monospaziato
.title = Testo monospaziato Markdown, digita ` a inizio e alla fine del testo. Da usare in modalità markdown
snippet-markdownQuote = citazione
.title = Citazione Markdown, digita `>` a inizio della riga seguito dalla citazione. Da usare in modalità markdown
snippet-markdownTable = tabella
.title = Tabella Markdown, digita `|` per separare righe e colonne. Da usare in modalità markdown
snippet-dryRunFlag = esecuzione simulata
.title = Verifica che il template sia in modalità simulata, ad esempio come anteprima. In modalità di esecuzione simulata, lo script non apporta modifiche e quindi non dovrebbe avere effetti indesiderati.
snippet-itemBeforeLoop = prima del loop
@ -84,20 +101,6 @@ snippet-itemInLoop = nel loop
snippet-itemAfterLoop = dopo il loop
.title = Contenuto da renderizzare dopo il loop degli elementi
.title = Markdown link, type `[` at the beginning and `](url)` at the end of your text. Should be used in markdown mode
snippet-markdownMonospace = monospace text
.title = Markdown monospace text, type ` at the beginning and end of your text. Should be used in markdown mode
snippet-markdownQuote = quote
.title = Markdown quote, type `>` at the beginning of the line followed by your quote. Should be used in markdown mode
snippet-markdownTable = table
.title = Markdown table, type `|` to separate columns and rows. Should be used in markdown mode
snippet-dryRunFlag = dry run flag
.title = Check if the template is running in dry run mode, e.g. for preview. In dry run mode, the script should not have side effects.
snippet-itemBeforeLoop = before loop
.title = Content to be rendered before the loop of items
snippet-itemInLoop = in loop
.title = Content to be rendered for each item in the loop
snippet-itemAfterLoop = after loop
.title = Content to be rendered after the loop of items
-variable-type = Type
-variable-item = Zotero.Item

View File

@ -45,36 +45,53 @@ restore =
help =
.label = Помощь
format-bold =
.title = Bold
format-italic =
.title = Italic
format-strikethrough =
.title = Strike-through
format-underline =
.title = Underline
format-superscript =
.title = Superscript
format-subscript =
.title = Subscript
format-textColor =
.title = Text color
format-link =
.title = Link
format-quote =
.title = Quote
format-monospaced =
.title = Monospace
format-code =
.title = Code block
format-table =
.title = Table
format-h1 =
.title = Level 1 heading
format-h2 =
.title = Level 2 heading
format-h3 =
.title = Level 3 heading
format-bullet =
.title = Bullet list
format-numbered =
.title = Numbered list
format-inlineMath =
.title = Inline math formula
format-blockMath =
.title = Multi-line math formula
format-inlineScript =
.title = Add an inline JS script, the result of which will be embedded in the note
format-blockScript =
.title = Add a multi-line async JS script, the return value of which will be embedded in the note
snippet-useMarkdown = use markdown
.title = Parse the template as markdown
snippet-useRefresh = use refresh
.title = Allow the content generated by the template to be refreshed
snippet-inlineScript = inline script
.title = Add an inline JS script, the result of which will be embedded in the note
snippet-multiLineScript = multi-line script
.title = Add a multi-line async JS script, the return value of which will be embedded in the note
snippet-markdownHeading1 = heading 1
.title = Markdown heading 1, type `#` at the beginning of the line followed by your heading. Should be used in markdown mode
snippet-markdownHeading2 = heading 2
.title = Markdown heading 2, type `##` at the beginning of the line followed by your heading. Should be used in markdown mode
snippet-markdownHeading3 = heading 3
.title = Markdown heading 3, type `###` at the beginning of the line followed by your heading. Should be used in markdown mode
snippet-markdownBullet = bullet list
.title = Markdown bullet list, type `-` at the beginning of the line followed by your list item. Should be used in markdown mode
snippet-markdownNumber = number list
.title = Markdown number list, type `1.` at the beginning of the line followed by your list item. Should be used in markdown mode
snippet-markdownBold = bold text
.title = Markdown bold text, type `**` at the beginning and end of your text. Should be used in markdown mode
snippet-markdownItalic = italic text
.title = Markdown italic text, type `_` at the beginning and end of your text. Should be used in markdown mode
snippet-markdownLink = link
.title = Markdown link, type `[` at the beginning and `](url)` at the end of your text. Should be used in markdown mode
snippet-markdownMonospace = monospace text
.title = Markdown monospace text, type ` at the beginning and end of your text. Should be used in markdown mode
snippet-markdownQuote = quote
.title = Markdown quote, type `>` at the beginning of the line followed by your quote. Should be used in markdown mode
snippet-markdownTable = table
.title = Markdown table, type `|` to separate columns and rows. Should be used in markdown mode
snippet-dryRunFlag = dry run flag
.title = Check if the template is running in dry run mode, e.g. for preview. In dry run mode, the script should not have side effects.
snippet-itemBeforeLoop = before loop

View File

@ -45,36 +45,53 @@ restore =
help =
.label = Yardım
format-bold =
.title = Bold
format-italic =
.title = Italic
format-strikethrough =
.title = Strike-through
format-underline =
.title = Underline
format-superscript =
.title = Superscript
format-subscript =
.title = Subscript
format-textColor =
.title = Text color
format-link =
.title = Link
format-quote =
.title = Quote
format-monospaced =
.title = Monospace
format-code =
.title = Code block
format-table =
.title = Table
format-h1 =
.title = Level 1 heading
format-h2 =
.title = Level 2 heading
format-h3 =
.title = Level 3 heading
format-bullet =
.title = Bullet list
format-numbered =
.title = Numbered list
format-inlineMath =
.title = Inline math formula
format-blockMath =
.title = Multi-line math formula
format-inlineScript =
.title = Add an inline JS script, the result of which will be embedded in the note
format-blockScript =
.title = Add a multi-line async JS script, the return value of which will be embedded in the note
snippet-useMarkdown = use markdown
.title = Parse the template as markdown
snippet-useRefresh = use refresh
.title = Allow the content generated by the template to be refreshed
snippet-inlineScript = inline script
.title = Add an inline JS script, the result of which will be embedded in the note
snippet-multiLineScript = multi-line script
.title = Add a multi-line async JS script, the return value of which will be embedded in the note
snippet-markdownHeading1 = heading 1
.title = Markdown heading 1, type `#` at the beginning of the line followed by your heading. Should be used in markdown mode
snippet-markdownHeading2 = heading 2
.title = Markdown heading 2, type `##` at the beginning of the line followed by your heading. Should be used in markdown mode
snippet-markdownHeading3 = heading 3
.title = Markdown heading 3, type `###` at the beginning of the line followed by your heading. Should be used in markdown mode
snippet-markdownBullet = bullet list
.title = Markdown bullet list, type `-` at the beginning of the line followed by your list item. Should be used in markdown mode
snippet-markdownNumber = number list
.title = Markdown number list, type `1.` at the beginning of the line followed by your list item. Should be used in markdown mode
snippet-markdownBold = bold text
.title = Markdown bold text, type `**` at the beginning and end of your text. Should be used in markdown mode
snippet-markdownItalic = italic text
.title = Markdown italic text, type `_` at the beginning and end of your text. Should be used in markdown mode
snippet-markdownLink = link
.title = Markdown link, type `[` at the beginning and `](url)` at the end of your text. Should be used in markdown mode
snippet-markdownMonospace = monospace text
.title = Markdown monospace text, type ` at the beginning and end of your text. Should be used in markdown mode
snippet-markdownQuote = quote
.title = Markdown quote, type `>` at the beginning of the line followed by your quote. Should be used in markdown mode
snippet-markdownTable = table
.title = Markdown table, type `|` to separate columns and rows. Should be used in markdown mode
snippet-dryRunFlag = dry run flag
.title = Check if the template is running in dry run mode, e.g. for preview. In dry run mode, the script should not have side effects.
snippet-itemBeforeLoop = before loop

View File

@ -44,36 +44,53 @@ restore =
help =
.label = 帮助
format-bold =
.title = 加粗
format-italic =
.title = 斜体
format-strikethrough =
.title = 删除线
format-underline =
.title = 下划线
format-superscript =
.title = 上标
format-subscript =
.title = 下标
format-textColor =
.title = 文本颜色
format-link =
.title = 添加链接
format-quote =
.title = 引用文本
format-monospaced =
.title = 单行
format-code =
.title = 多行代码
format-table =
.title = 添加表格
format-h1 =
.title = 一级标题
format-h2 =
.title = 二级标题
format-h3 =
.title = 三级标题
format-bullet =
.title = 无序列表
format-numbered =
.title = 有序列表
format-inlineMath =
.title = 行内数学公式
format-blockMath =
.title = 多行数学公式
format-inlineScript =
.title = 添加行内JS脚本结果将嵌入到笔记中
format-blockScript =
.title = 添加多行异步JS脚本返回值将嵌入到笔记中
snippet-useMarkdown = 使用 markdown
.title = 将模板解析为 markdown
snippet-useRefresh = 允许内容刷新
.title = 允许模板生成的内容刷新
snippet-inlineScript = 内联脚本
.title = 添加一个内联 JS 脚本,其结果将嵌入到笔记中
snippet-multiLineScript = 多行脚本
.title = 添加一个多行异步 JS 脚本,其返回值将嵌入到笔记中
snippet-markdownHeading1 = 一级标题
.title = Markdown 一级标题,在行首输入 `#` 后跟你的标题。应在 Markdown 模式下使用
snippet-markdownHeading2 = 二级标题
.title = Markdown 二级标题,在行首输入 `##` 后跟你的标题。应在 Markdown 模式下使用
snippet-markdownHeading3 = 三级标题
.title = Markdown 三级标题,在行首输入 `###` 后跟你的标题。应在 Markdown 模式下使用
snippet-markdownBullet = 无序列表
.title = Markdown 无序列表,在行首输入 `-` 后跟你的列表项。应在 Markdown 模式下使用
snippet-markdownNumber = 有序列表
.title = Markdown 有序列表,在行首输入 `1.` 后跟你的列表项。应在 Markdown 模式下使用
snippet-markdownBold = 加粗文本
.title = Markdown 加粗文本,在文本的开头和结尾输入 `**`。应在 Markdown 模式下使用
snippet-markdownItalic = 斜体文本
.title = Markdown 斜体文本,在文本的开头和结尾输入 `_`。应在 Markdown 模式下使用
snippet-markdownLink = 链接
.title = Markdown 链接,在文本的开头输入 `[`,在结尾输入 `](url)`。应在 Markdown 模式下使用
snippet-markdownMonospace = 单行
.title = Markdown 单行,在文本的开头和结尾输入 `。应在 Markdown 模式下使用
snippet-markdownQuote = 引用
.title = Markdown 引用,在行首输入 `>` 后跟你的引用内容。应在 Markdown 模式下使用
snippet-markdownTable = 表格
.title = Markdown 表格,使用 `|` 分隔列和行。应在 Markdown 模式下使用
snippet-dryRunFlag = dry run标志
.title = 检查模板是否在dry run模式下运行例如用于预览。在dry run模式下脚本不应有副作用。
snippet-itemBeforeLoop = 循环前

View File

@ -90,11 +90,20 @@ async function runTemplate(
},
);
// Match the backticks not inside a `${}` and replace them with a placeholder
// Not inside a `${}`
templateText = templateText.replace(/`(?![^${]*\})(?<!\${[^`]*`)/g, "__bt__");
try {
const func = new AsyncFunction(argString, "return `" + templateText + "`");
const res = await func(...argList);
let res = (await func(...argList)) as string;
if (useMarkdown) {
// Replace the placeholder back to backticks
res = res.replace(/__bt__/g, "`");
res = await addon.api.convert.md2html(res);
}
ztoolkit.log(res);
return useMarkdown ? await addon.api.convert.md2html(res) : res;
return res;
} catch (e) {
ztoolkit.log(e);
if (options.dryRun) {

View File

@ -205,6 +205,7 @@ export async function showTemplateEditor() {
});
addon.data.template.editor.monaco = monaco;
addon.data.template.editor.editor = editor;
await initFormats();
}
}
@ -285,6 +286,9 @@ function updateEditor() {
const saveTemplate = win?.document.getElementById("save") as XUL.Button;
const deleteTemplate = win?.document.getElementById("delete") as XUL.Button;
const resetTemplate = win?.document.getElementById("reset") as XUL.Button;
const formats = win?.document.getElementById(
"formats-container",
) as HTMLDivElement;
const snippets = win?.document.getElementById(
"snippets-container",
) as HTMLDivElement;
@ -298,6 +302,7 @@ function updateEditor() {
deleteTemplate.setAttribute("disabled", "true");
deleteTemplate.hidden = false;
resetTemplate.hidden = true;
formats.hidden = true;
snippets.hidden = true;
} else {
templateType.value = type;
@ -318,6 +323,7 @@ function updateEditor() {
editor.hidden = false;
saveTemplate.removeAttribute("disabled");
deleteTemplate.removeAttribute("disabled");
formats.hidden = false;
snippets.hidden = false;
updateSnippets(
(type === "system"
@ -327,6 +333,91 @@ function updateEditor() {
}
}
async function initFormats() {
const container =
addon.data.template.editor.window?.document.querySelector(
"#formats-container",
);
if (!container) {
return;
}
container.innerHTML = "";
// Add formats to the container, with each format as a button
for (const format of formatStore) {
const button = document.createElement("div");
button.classList.add("format", format.name);
button.style.backgroundImage = `url("chrome://${config.addonRef}/content/icons/editor/${format.name}.svg")`;
button.dataset.l10nId = `${config.addonRef}-format-${format.name}`;
button.addEventListener("click", () => {
const { editor, monaco } = addon.data.template.editor;
const selection = editor.getSelection();
const range = new monaco.Range(
selection.startLineNumber,
selection.startColumn,
selection.endLineNumber,
selection.endColumn,
);
const textTemplate = format.code;
const source =
editor.getModel().getValueInRange(range) ||
format.defaultText ||
"text";
const text = textTemplate.replace("${text}", source);
editor.executeEdits("", [
{
range,
text,
forceMoveMarkers: true,
},
]);
// Keep the selection after inserting the format
const textBeforeReplace = textTemplate.split("${text}")[0];
const textBeforeLines = textBeforeReplace.split("\n");
const textLines = source.split("\n");
// Calculate the new range
const startLineNumber =
selection.startLineNumber + textBeforeLines.length - 1;
const startColumn =
textBeforeLines.length === 1
? selection.startColumn + textBeforeReplace.length
: textBeforeLines.slice(-1)[0].length + 1;
const endLineNumber = startLineNumber + textLines.length - 1;
const endColumn =
textLines.length === 1
? startColumn + source.length
: textLines.slice(-1)[0].length + 1;
const newRange = new monaco.Range(
startLineNumber,
startColumn,
endLineNumber,
endColumn,
);
editor.setSelection(newRange);
// If editor does not contain a line start with // @use-markdown, insert it
if (
!editor
.getModel()
.getLinesContent()
.some((line: any) => line.startsWith("// @use-markdown"))
) {
editor.executeEdits("", [
{
range: new monaco.Range(1, 1, 1, 1),
text: "// @use-markdown\n",
forceMoveMarkers: true,
},
]);
}
});
container.appendChild(button);
}
}
async function updateSnippets(type: string) {
const container = addon.data.template.editor.window?.document.querySelector(
"#snippets-container",
@ -336,9 +427,9 @@ async function updateSnippets(type: string) {
}
container.innerHTML = "";
const snippets = snippetsStore[type as keyof typeof snippetsStore].concat(
snippetsStore.global,
);
const snippets = (
snippetsStore[type as keyof typeof snippetsStore] || []
).concat(snippetsStore.global);
if (!snippets) {
return;
}
@ -596,6 +687,94 @@ async function restoreTemplates(win: Window) {
await refresh();
}
const formatStore = [
{
name: "bold",
code: "**${text}**",
},
{
name: "italic",
code: "_${text}_",
},
{
name: "strikethrough",
code: "~~${text}~~",
},
{
name: "underline",
code: "<u>${text}</u>",
},
{
name: "superscript",
code: "<sup>${text}</sup>",
},
{ name: "subscript", code: "<sub>${text}</sub>" },
{
name: "textColor",
code: '<span style="color: orange">${text}</span>',
},
{
name: "link",
code: "[${text}](url)",
},
{
name: "quote",
code: "\n> ${text}",
},
{
name: "monospaced",
code: "`${text}`",
},
{
name: "code",
code: "\n```\n${text}\n```\n",
},
{
name: "table",
code: "\n| ${text} | Header 2 |\n|----------|----------|\n| Cell 1 | Cell 2 |\n",
},
{
name: "h1",
code: "\n# ${text}",
},
{
name: "h2",
code: "\n## ${text}",
},
{
name: "h3",
code: "\n### ${text}",
},
{
name: "bullet",
code: "\n- ${text}",
},
{
name: "numbered",
code: "\n1. ${text}",
},
{
name: "inlineMath",
code: "$${text}$",
defaultText: "e=mc^2",
},
{
name: "blockMath",
code: "\n$$\n${text}\n$$\n",
defaultText: "e=mc^2",
},
{
name: "inlineScript",
code: "${ ${text} }",
defaultText: "Zotero.version",
},
{
name: "blockScript",
code: "\n${{\n ${text}\n}}$\n",
defaultText: "return Zotero.version;",
},
];
const snippetsStore = {
global: [
{
@ -608,77 +787,6 @@ const snippetsStore = {
code: "\n// @use-refresh\n",
type: "syntax",
},
{
name: "inlineScript",
code: "${ // write your script here }",
type: "syntax",
},
{
name: "multiLineScript",
code: "\n${{\n // write your script here\n}}$\n",
type: "syntax",
},
{
name: "markdownHeading1",
code: "\n# type your heading here",
type: "syntax",
},
{
name: "markdownHeading2",
code: "\n## type your heading here",
type: "syntax",
},
{
name: "markdownHeading3",
code: "\n### type your heading here",
type: "syntax",
},
{
name: "markdownBullet",
code: "\n\n- type your bullet list here",
type: "syntax",
},
{
name: "markdownNumber",
code: "\n\n1. type your number list here",
type: "syntax",
},
{
name: "markdownBold",
code: "**type your bold text here**",
type: "syntax",
},
{
name: "markdownItalic",
code: "_type your italic text here_",
type: "syntax",
},
{
name: "markdownLink",
code: "[type your link text here](type your link url here)",
type: "syntax",
},
{
name: "markdownMonospace",
code: "\n\n`type your text here`",
type: "syntax",
},
{
name: "markdownQuote",
code: "\n\n> type your quote here",
type: "syntax",
},
{
name: "markdownTable",
code: `
| Header 1 | Header 2 |
|----------|----------|
| Cell 1 | Cell 2 |
`,
type: "syntax",
},
{
name: "dryRunFlag",
code: "_env.dryRun",

View File

@ -1,5 +1,6 @@
import YAML = require("yamljs");
import { getNoteLink } from "../../utils/link";
import { renderNoteHTML } from "../../utils/note";
export { renderTemplatePreview };
@ -142,6 +143,9 @@ async function renderTemplatePreview(
html = generateWarning(`Error: ${err.message || "Unknown error"}`);
}
// TODO: might not be stable?
html = await renderNoteHTML(html, []);
return html;
}