forge-edit 0.1.0-beta.5 → 0.1.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1216 -607
- package/package.json +4 -2
- package/README.md +0 -216
- package/dist/index.css +0 -2
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:"";--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-serif:ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-gray-100:oklch(96.7% .003 264.542);--color-gray-700:oklch(37.3% .034 259.733);--color-black:#000;--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-sm:.25rem;--radius-md:.375rem;--ease-in-out:cubic-bezier(.4, 0, .2, 1);--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.-top-2{top:calc(var(--spacing) * -2)}.top-0{top:0}.top-\\[1px\\]{top:1px}.top-\\[calc\\(100\\%\\+4px\\)\\]{top:calc(100% + 4px)}.top-\\[calc\\(100\\%\\+8px\\)\\]{top:calc(100% + 8px)}.top-full{top:100%}.left-0{left:0}.left-1\\/2{left:50%}.left-\\[-7px\\]{left:-7px}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-\\[1\\]{z-index:1}.z-\\[2\\]{z-index:2}.z-\\[3\\]{z-index:3}.z-\\[5\\]{z-index:5}.z-\\[9999\\]{z-index:9999}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.m-0{margin:0}.mx-auto{margin-inline:auto}.my-1{margin-block:var(--spacing)}.my-2{margin-block:calc(var(--spacing) * 2)}.mt-1{margin-top:var(--spacing)}.mb-0\\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1\\.5{margin-bottom:calc(var(--spacing) * 1.5)}.box-border{box-sizing:border-box}.block{display:block}.flex{display:flex}.hidden{display:none}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.h-2{height:calc(var(--spacing) * 2)}.h-2\\.5{height:calc(var(--spacing) * 2.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-40{height:calc(var(--spacing) * 40)}.h-\\[30px\\]{height:30px}.h-full{height:100%}.h-px{height:1px}.max-h-24{max-height:calc(var(--spacing) * 24)}.max-h-\\[220px\\]{max-height:220px}.min-h-\\[60px\\]{min-height:60px}.min-h-\\[120px\\]{min-height:120px}.w-2{width:calc(var(--spacing) * 2)}.w-2\\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-7{width:calc(var(--spacing) * 7)}.w-40{width:calc(var(--spacing) * 40)}.w-\\[1px\\]{width:1px}.w-full{width:100%}.max-w-\\[65px\\]{max-width:65px}.min-w-4{min-width:calc(var(--spacing) * 4)}.min-w-\\[18px\\]{min-width:18px}.min-w-\\[28px\\]{min-width:28px}.min-w-\\[70px\\]{min-width:70px}.min-w-\\[110px\\]{min-width:110px}.min-w-\\[130px\\]{min-width:130px}.min-w-\\[150px\\]{min-width:150px}.min-w-\\[160px\\]{min-width:160px}.min-w-\\[180px\\]{min-width:180px}.min-w-\\[200px\\]{min-width:200px}.flex-1{flex:1}.flex-shrink-0{flex-shrink:0}.-translate-x-1\\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.cursor-pointer{cursor:pointer}.cursor-s-resize{cursor:s-resize}.resize{resize:both}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-0\\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-\\[4px\\]{gap:4px}.gap-px{gap:1px}:where(.-space-x-px>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(-1px * var(--tw-space-x-reverse));margin-inline-end:calc(-1px * calc(1 - var(--tw-space-x-reverse)))}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-\\[\\#ccc\\]>:not(:last-child)){border-color:#ccc}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\\[1px\\]{border-radius:1px}.rounded-\\[2px\\]{border-radius:2px}.rounded-\\[3px\\]{border-radius:3px}.rounded-\\[4px\\]{border-radius:4px}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-t-\\[3px\\]{border-top-left-radius:3px;border-top-right-radius:3px}.rounded-b-\\[3px\\]{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-r-7{border-right-style:var(--tw-border-style);border-right-width:7px}.border-r-8{border-right-style:var(--tw-border-style);border-right-width:8px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-7{border-bottom-style:var(--tw-border-style);border-bottom-width:7px}.border-b-8{border-bottom-style:var(--tw-border-style);border-bottom-width:8px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-7{border-left-style:var(--tw-border-style);border-left-width:7px}.border-l-8{border-left-style:var(--tw-border-style);border-left-width:8px}.border-none{--tw-border-style:none;border-style:none}.border-\\[\\#2c2c2c\\]{border-color:#2c2c2c}.border-\\[\\#4a90d9\\]{border-color:#4a90d9}.border-\\[\\#ccc\\]{border-color:#ccc}.border-\\[\\#d1d5db\\]{border-color:#d1d5db}.border-\\[\\#ddd\\]{border-color:#ddd}.border-\\[\\#eee\\]{border-color:#eee}.border-black{border-color:var(--color-black)}.border-r-transparent{border-right-color:#0000}.border-b-\\[\\#ccc\\]{border-bottom-color:#ccc}.border-b-white{border-bottom-color:var(--color-white)}.border-l-transparent{border-left-color:#0000}.bg-\\[\\#1e1e1e\\]{background-color:#1e1e1e}.bg-\\[\\#888\\]{background-color:#888}.bg-\\[\\#e2e8f0\\]{background-color:#e2e8f0}.bg-\\[\\#e5e7eb\\]{background-color:#e5e7eb}.bg-\\[\\#f0f0f0\\]{background-color:#f0f0f0}.bg-\\[\\#f5f5f5\\]{background-color:#f5f5f5}.bg-\\[rgba\\(74\\,144\\,217\\,0\\.4\\)\\]{background-color:#4a90d966}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\\/30{background-color:#ffffff4d}@supports (color:color-mix(in lab, red, red)){.bg-white\\/30{background-color:color-mix(in oklab, var(--color-white) 30%, transparent)}}.bg-\\[linear-gradient\\(rgba\\(0\\,0\\,0\\,0\\.05\\)_1px\\,transparent_1px\\)\\,linear-gradient\\(90deg\\,rgba\\(0\\,0\\,0\\,0\\.05\\)_1px\\,transparent_1px\\)\\]{background-image:linear-gradient(#0000000d 1px,#0000 1px),linear-gradient(90deg,#0000000d 1px,#0000 1px)}.bg-\\[size\\:16px_16px\\]{background-size:16px 16px}.fill-current{fill:currentColor}.fill-none{fill:none}.stroke-black{stroke:var(--color-black)}.p-0{padding:0}.p-1{padding:var(--spacing)}.p-1\\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-\\[5px\\]{padding:5px}.p-\\[10px\\]{padding:10px}.px-0{padding-inline:0}.px-1{padding-inline:var(--spacing)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-\\[7px\\]{padding-inline:7px}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.pt-1\\.5{padding-top:calc(var(--spacing) * 1.5)}.pr-1{padding-right:var(--spacing)}.pr-1\\.5{padding-right:calc(var(--spacing) * 1.5)}.pb-0\\.5{padding-bottom:calc(var(--spacing) * .5)}.pb-1{padding-bottom:var(--spacing)}.pb-12{padding-bottom:calc(var(--spacing) * 12)}.pl-5{padding-left:calc(var(--spacing) * 5)}.text-center{text-align:center}.text-left{text-align:left}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.font-serif{font-family:var(--font-serif)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.text-\\[13px\\]{font-size:13px}.text-\\[14px\\]{font-size:14px}.text-\\[15px\\]{font-size:15px}.text-\\[16px\\]{font-size:16px}.text-\\[18px\\]{font-size:18px}.text-\\[20px\\]{font-size:20px}.leading-\\[1\\.4\\]{--tw-leading:1.4;line-height:1.4}.leading-none{--tw-leading:1;line-height:1}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.whitespace-nowrap{white-space:nowrap}.text-\\[\\#333\\]{color:#333}.text-\\[\\#666\\]{color:#666}.text-black{color:var(--color-black)}.text-gray-700{color:var(--color-gray-700)}.text-white{color:var(--color-white)}.not-italic{font-style:normal}.no-underline{text-decoration-line:none}.underline{text-decoration-line:underline}.opacity-0{opacity:0}.shadow-\\[0_2px_6px_rgba\\(0\\,0\\,0\\,0\\.15\\)\\]{--tw-shadow:0 2px 6px var(--tw-shadow-color,#00000026);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\\[0_2px_8px_rgba\\(0\\,0\\,0\\,0\\.15\\)\\]{--tw-shadow:0 2px 8px var(--tw-shadow-color,#00000026);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\\[inset_0_1px_3px_rgba\\(0\\,0\\,0\\,0\\.2\\)\\]{--tw-shadow:inset 0 1px 3px var(--tw-shadow-color,#0003);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition-\\[width\\,height\\]{transition-property:width,height;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-75{--tw-duration:75ms;transition-duration:75ms}.duration-100{--tw-duration:.1s;transition-duration:.1s}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.outline-none{--tw-outline-style:none;outline-style:none}@media (hover:hover){.group-hover\\:visible:is(:where(.group):hover *){visibility:visible}.group-hover\\:opacity-100:is(:where(.group):hover *){opacity:1}}.group-has-\\[\\.is-open\\]\\:hidden:is(:where(.group):has(.is-open) *){display:none}.before\\:absolute:before{content:var(--tw-content);position:absolute}.before\\:bottom-full:before{content:var(--tw-content);bottom:100%}.before\\:left-1\\/2:before{content:var(--tw-content);left:50%}.before\\:-translate-x-1\\/2:before{content:var(--tw-content);--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.before\\:border-x-\\[5px\\]:before{content:var(--tw-content);border-inline-style:var(--tw-border-style);border-inline-width:5px}.before\\:border-t-0:before{content:var(--tw-content);border-top-style:var(--tw-border-style);border-top-width:0}.before\\:border-b-\\[5px\\]:before{content:var(--tw-content);border-bottom-style:var(--tw-border-style);border-bottom-width:5px}.before\\:border-solid:before{content:var(--tw-content);--tw-border-style:solid;border-style:solid}.before\\:border-x-transparent:before{content:var(--tw-content);border-inline-color:#0000}.before\\:border-b-\\[\\#2c2c2c\\]:before{content:var(--tw-content);border-bottom-color:#2c2c2c}.after\\:absolute:after{content:var(--tw-content);position:absolute}.after\\:bottom-full:after{content:var(--tw-content);bottom:100%}.after\\:left-1\\/2:after{content:var(--tw-content);left:50%}.after\\:-translate-x-1\\/2:after{content:var(--tw-content);--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.after\\:translate-y-\\[1px\\]:after{content:var(--tw-content);--tw-translate-y:1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.after\\:border-x-\\[4px\\]:after{content:var(--tw-content);border-inline-style:var(--tw-border-style);border-inline-width:4px}.after\\:border-t-0:after{content:var(--tw-content);border-top-style:var(--tw-border-style);border-top-width:0}.after\\:border-b-\\[4px\\]:after{content:var(--tw-content);border-bottom-style:var(--tw-border-style);border-bottom-width:4px}.after\\:border-solid:after{content:var(--tw-content);--tw-border-style:solid;border-style:solid}.after\\:border-x-transparent:after{content:var(--tw-content);border-inline-color:#0000}.after\\:border-b-\\[\\#1e1e1e\\]:after{content:var(--tw-content);border-bottom-color:#1e1e1e}.last\\:border-r-0:last-child{border-right-style:var(--tw-border-style);border-right-width:0}.last\\:pr-0:last-child{padding-right:0}@media (hover:hover){.hover\\:scale-110:hover{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\\:border-\\[\\#999\\]:hover{border-color:#999}.hover\\:border-\\[\\#aaa\\]:hover{border-color:#aaa}.hover\\:border-black:hover{border-color:var(--color-black)}.hover\\:bg-\\[\\#e6e6e6\\]:hover{background-color:#e6e6e6}.hover\\:bg-\\[\\#f0f0f0\\]:hover{background-color:#f0f0f0}.hover\\:bg-\\[\\#f5f5f5\\]:hover{background-color:#f5f5f5}.hover\\:bg-\\[\\#f9f9f9\\]:hover{background-color:#f9f9f9}.hover\\:bg-black\\/5:hover{background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-black\\/5:hover{background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.hover\\:bg-gray-100:hover{background-color:var(--color-gray-100)}}.focus\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.active\\:translate-y-px:active{--tw-translate-y:1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.active\\:bg-\\[\\#d0d0d0\\]:active{background-color:#d0d0d0}.active\\:bg-\\[\\#e8e8e8\\]:active{background-color:#e8e8e8}.rtl\\:right-0:where(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),[dir=rtl],[dir=rtl] *){right:0}.rtl\\:left-1\\/2:where(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),[dir=rtl],[dir=rtl] *){left:50%}.rtl\\:left-auto:where(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),[dir=rtl],[dir=rtl] *){left:auto}.rtl\\:-translate-x-1\\/2:where(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),[dir=rtl],[dir=rtl] *){--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}:where(.rtl\\:divide-x-reverse:where(:is(:lang(ae),:lang(ar),:lang(arc),:lang(bcc),:lang(bqi),:lang(ckb),:lang(dv),:lang(fa),:lang(glk),:lang(he),:lang(ku),:lang(mzn),:lang(nqo),:lang(pnb),:lang(ps),:lang(sd),:lang(ug),:lang(ur),:lang(yi)),[dir=rtl],[dir=rtl] *)>:not(:last-child)){--tw-divide-x-reverse:1}.\\[\\&_blockquote\\]\\:my-2 blockquote{margin-block:calc(var(--spacing) * 2)}.\\[\\&_blockquote\\]\\:border-l-4 blockquote{border-left-style:var(--tw-border-style);border-left-width:4px}.\\[\\&_blockquote\\]\\:border-\\[\\#ccc\\] blockquote{border-color:#ccc}.\\[\\&_blockquote\\]\\:pl-4 blockquote{padding-left:calc(var(--spacing) * 4)}.\\[\\&_blockquote\\]\\:italic blockquote{font-style:italic}.\\[\\&_h1\\]\\:text-2xl h1{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.\\[\\&_h1\\]\\:font-bold h1{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.\\[\\&_h2\\]\\:text-xl h2{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.\\[\\&_h2\\]\\:font-bold h2{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.\\[\\&_h3\\]\\:text-lg h3{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.\\[\\&_h3\\]\\:font-bold h3{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.\\[\\&_pre\\]\\:rounded pre{border-radius:.25rem}.\\[\\&_pre\\]\\:bg-\\[\\#f4f4f4\\] pre{background-color:#f4f4f4}.\\[\\&_pre\\]\\:p-2 pre{padding:calc(var(--spacing) * 2)}.\\[\\&\\.is-active\\]\\:bg-\\[\\#e5e5e5\\].is-active{background-color:#e5e5e5}.\\[\\&\\.is-open\\]\\:block.is-open{display:block}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
|
|
1
2
|
import { options as e, render as t } from "preact";
|
|
2
3
|
import { useEffect as n, useRef as r, useState as i } from "preact/hooks";
|
|
3
4
|
import a from "sweetalert2";
|
|
@@ -43,89 +44,118 @@ function c(t, n, r, i, a, o) {
|
|
|
43
44
|
//#endregion
|
|
44
45
|
//#region src/components/shared/toolbar/Style/Components/StyleToolbar.jsx
|
|
45
46
|
function l() {
|
|
47
|
+
let e = "forge-dropdown-item block w-full text-left cursor-pointer whitespace-nowrap px-3 py-1 text-[#333] no-underline transition-colors duration-100 hover:bg-[#f0f0f0]";
|
|
46
48
|
return /* @__PURE__ */ c("div", {
|
|
47
|
-
className: "forge-toolbar-group forge-toolbar-style",
|
|
49
|
+
className: "forge-toolbar-group forge-toolbar-style flex items-center gap-0.5",
|
|
48
50
|
children: /* @__PURE__ */ c("div", {
|
|
49
|
-
className: "
|
|
51
|
+
className: "relative group",
|
|
50
52
|
children: [/* @__PURE__ */ c("button", {
|
|
51
53
|
type: "button",
|
|
52
|
-
className: "forge-toolbar-button",
|
|
54
|
+
className: "forge-toolbar-button group relative flex h-7 cursor-pointer items-center justify-center rounded-[2px] border border-[#ccc] bg-white px-2 text-sm leading-none transition-all duration-150 hover:bg-[#f0f0f0] active:translate-y-px [&.is-active]:bg-[#e5e5e5]",
|
|
53
55
|
"data-command": "style",
|
|
54
56
|
"aria-label": "Style",
|
|
55
57
|
children: [/* @__PURE__ */ c("span", {
|
|
56
58
|
className: "forge-icon",
|
|
57
59
|
children: "✦"
|
|
58
60
|
}), /* @__PURE__ */ c("span", {
|
|
59
|
-
className: "
|
|
60
|
-
"data-i18n": "style"
|
|
61
|
+
className: "pointer-events-none absolute left-1/2 top-[calc(100%+8px)] z-30 -translate-x-1/2 whitespace-nowrap rounded-md border border-[#2c2c2c] bg-[#1e1e1e] px-2.5 py-1 text-[11px] font-medium leading-none text-white opacity-0 shadow-lg transition-all duration-200 group-hover:visible group-hover:opacity-100 group-has-[.is-open]:hidden rtl:left-1/2 rtl:-translate-x-1/2 before:absolute before:bottom-full before:left-1/2 before:-translate-x-1/2 before:border-x-[5px] before:border-b-[5px] before:border-t-0 before:border-solid before:border-x-transparent before:border-b-[#2c2c2c] after:absolute after:bottom-full after:left-1/2 after:-translate-x-1/2 after:translate-y-[1px] after:border-x-[4px] after:border-b-[4px] after:border-t-0 after:border-solid after:border-x-transparent after:border-b-[#1e1e1e]",
|
|
62
|
+
"data-i18n": "style",
|
|
63
|
+
children: "Style"
|
|
61
64
|
})]
|
|
62
65
|
}), /* @__PURE__ */ c("div", {
|
|
63
|
-
className: "forge-toolbar-dropdown forge-dropdown-style",
|
|
66
|
+
className: "forge-toolbar-dropdown forge-dropdown-style absolute left-0 top-[calc(100%+4px)] z-20 hidden [&.is-open]:block max-h-24 min-w-[110px] overflow-y-auto rounded-[2px] border border-[#ccc] bg-white p-0 shadow-[0_2px_6px_rgba(0,0,0,0.15)] rtl:left-auto rtl:right-0",
|
|
64
67
|
role: "list",
|
|
65
68
|
"aria-label": "Style",
|
|
66
69
|
children: [
|
|
67
|
-
/* @__PURE__ */ c("
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
/* @__PURE__ */ c("button", {
|
|
71
|
+
type: "button",
|
|
72
|
+
className: e,
|
|
70
73
|
"data-value": "p",
|
|
71
74
|
role: "listitem",
|
|
72
|
-
children: /* @__PURE__ */ c("p", {
|
|
75
|
+
children: /* @__PURE__ */ c("p", {
|
|
76
|
+
className: "m-0 text-[13px] font-normal leading-[1.4]",
|
|
77
|
+
children: "Normal"
|
|
78
|
+
})
|
|
73
79
|
}),
|
|
74
|
-
/* @__PURE__ */ c("
|
|
75
|
-
|
|
76
|
-
|
|
80
|
+
/* @__PURE__ */ c("button", {
|
|
81
|
+
type: "button",
|
|
82
|
+
className: e,
|
|
77
83
|
"data-value": "blockquote",
|
|
78
84
|
role: "listitem",
|
|
79
|
-
children: /* @__PURE__ */ c("blockquote", {
|
|
85
|
+
children: /* @__PURE__ */ c("blockquote", {
|
|
86
|
+
className: "m-0 text-[13px] font-normal leading-[1.4]",
|
|
87
|
+
children: "Blockquote"
|
|
88
|
+
})
|
|
80
89
|
}),
|
|
81
|
-
/* @__PURE__ */ c("
|
|
82
|
-
|
|
83
|
-
|
|
90
|
+
/* @__PURE__ */ c("button", {
|
|
91
|
+
type: "button",
|
|
92
|
+
className: e,
|
|
84
93
|
"data-value": "pre",
|
|
85
94
|
role: "listitem",
|
|
86
|
-
children: /* @__PURE__ */ c("pre", {
|
|
95
|
+
children: /* @__PURE__ */ c("pre", {
|
|
96
|
+
className: "m-0 font-mono text-[13px] leading-[1.4]",
|
|
97
|
+
children: "Code"
|
|
98
|
+
})
|
|
87
99
|
}),
|
|
88
|
-
/* @__PURE__ */ c("
|
|
89
|
-
|
|
90
|
-
|
|
100
|
+
/* @__PURE__ */ c("button", {
|
|
101
|
+
type: "button",
|
|
102
|
+
className: e,
|
|
91
103
|
"data-value": "h1",
|
|
92
104
|
role: "listitem",
|
|
93
|
-
children: /* @__PURE__ */ c("h1", {
|
|
105
|
+
children: /* @__PURE__ */ c("h1", {
|
|
106
|
+
className: "m-0 text-[20px] font-normal leading-[1.4]",
|
|
107
|
+
children: "Heading 1"
|
|
108
|
+
})
|
|
94
109
|
}),
|
|
95
|
-
/* @__PURE__ */ c("
|
|
96
|
-
|
|
97
|
-
|
|
110
|
+
/* @__PURE__ */ c("button", {
|
|
111
|
+
type: "button",
|
|
112
|
+
className: e,
|
|
98
113
|
"data-value": "h2",
|
|
99
114
|
role: "listitem",
|
|
100
|
-
children: /* @__PURE__ */ c("h2", {
|
|
115
|
+
children: /* @__PURE__ */ c("h2", {
|
|
116
|
+
className: "m-0 text-[18px] font-normal leading-[1.4]",
|
|
117
|
+
children: "Heading 2"
|
|
118
|
+
})
|
|
101
119
|
}),
|
|
102
|
-
/* @__PURE__ */ c("
|
|
103
|
-
|
|
104
|
-
|
|
120
|
+
/* @__PURE__ */ c("button", {
|
|
121
|
+
type: "button",
|
|
122
|
+
className: e,
|
|
105
123
|
"data-value": "h3",
|
|
106
124
|
role: "listitem",
|
|
107
|
-
children: /* @__PURE__ */ c("h3", {
|
|
125
|
+
children: /* @__PURE__ */ c("h3", {
|
|
126
|
+
className: "m-0 text-[16px] font-normal leading-[1.4]",
|
|
127
|
+
children: "Heading 3"
|
|
128
|
+
})
|
|
108
129
|
}),
|
|
109
|
-
/* @__PURE__ */ c("
|
|
110
|
-
|
|
111
|
-
|
|
130
|
+
/* @__PURE__ */ c("button", {
|
|
131
|
+
type: "button",
|
|
132
|
+
className: e,
|
|
112
133
|
"data-value": "h4",
|
|
113
134
|
role: "listitem",
|
|
114
|
-
children: /* @__PURE__ */ c("h4", {
|
|
135
|
+
children: /* @__PURE__ */ c("h4", {
|
|
136
|
+
className: "m-0 text-[15px] font-normal leading-[1.4]",
|
|
137
|
+
children: "Heading 4"
|
|
138
|
+
})
|
|
115
139
|
}),
|
|
116
|
-
/* @__PURE__ */ c("
|
|
117
|
-
|
|
118
|
-
|
|
140
|
+
/* @__PURE__ */ c("button", {
|
|
141
|
+
type: "button",
|
|
142
|
+
className: e,
|
|
119
143
|
"data-value": "h5",
|
|
120
144
|
role: "listitem",
|
|
121
|
-
children: /* @__PURE__ */ c("h5", {
|
|
145
|
+
children: /* @__PURE__ */ c("h5", {
|
|
146
|
+
className: "m-0 text-[14px] font-normal leading-[1.4]",
|
|
147
|
+
children: "Heading 5"
|
|
148
|
+
})
|
|
122
149
|
}),
|
|
123
|
-
/* @__PURE__ */ c("
|
|
124
|
-
|
|
125
|
-
|
|
150
|
+
/* @__PURE__ */ c("button", {
|
|
151
|
+
type: "button",
|
|
152
|
+
className: e,
|
|
126
153
|
"data-value": "h6",
|
|
127
154
|
role: "listitem",
|
|
128
|
-
children: /* @__PURE__ */ c("h6", {
|
|
155
|
+
children: /* @__PURE__ */ c("h6", {
|
|
156
|
+
className: "m-0 text-[13px] font-normal leading-[1.4]",
|
|
157
|
+
children: "Heading 6"
|
|
158
|
+
})
|
|
129
159
|
})
|
|
130
160
|
]
|
|
131
161
|
})]
|
|
@@ -139,64 +169,300 @@ function u() {
|
|
|
139
169
|
}
|
|
140
170
|
//#endregion
|
|
141
171
|
//#region src/components/shared/toolbar/font/Components/FontToolbar.jsx
|
|
142
|
-
function d({ onCommand: e }) {
|
|
172
|
+
function d({ onCommand: e, isBold: t, isUnderline: n }) {
|
|
173
|
+
let r = "group relative flex h-7 w-7 items-center justify-center p-0 text-sm leading-none cursor-pointer transition-colors duration-150 active:translate-y-px", i = "bg-white text-[#333] hover:bg-[#f0f0f0]", a = "bg-[#e2e8f0] text-black border-inner shadow-[inset_0_1px_3px_rgba(0,0,0,0.2)] font-bold", o = "pointer-events-none absolute left-1/2 top-[calc(100%+8px)] z-30 -translate-x-1/2 whitespace-nowrap rounded-md border border-[#2c2c2c] bg-[#1e1e1e] px-2.5 py-1 text-[11px] font-medium leading-none text-white opacity-0 shadow-lg transition-all duration-200 group-hover:visible group-hover:opacity-100 rtl:left-1/2 rtl:-translate-x-1/2 before:absolute before:bottom-full before:left-1/2 before:-translate-x-1/2 before:border-x-[5px] before:border-b-[5px] before:border-t-0 before:border-solid before:border-x-transparent before:border-b-[#2c2c2c] after:absolute after:bottom-full after:left-1/2 after:-translate-x-1/2 after:translate-y-[1px] after:border-x-[4px] after:border-b-[4px] after:border-t-0 after:border-solid after:border-x-transparent after:border-b-[#1e1e1e]";
|
|
143
174
|
return /* @__PURE__ */ c("div", {
|
|
144
|
-
className: "forge-toolbar-group forge-toolbar-font",
|
|
175
|
+
className: "forge-toolbar-group forge-toolbar-font inline-flex items-center rounded-sm border border-[#ccc] bg-white divide-x divide-[#ccc] rtl:divide-x-reverse",
|
|
145
176
|
children: [
|
|
146
177
|
/* @__PURE__ */ c("button", {
|
|
147
178
|
type: "button",
|
|
148
|
-
className:
|
|
179
|
+
className: `${r} ${t ? a : i}`,
|
|
149
180
|
onClick: () => e("bold"),
|
|
150
181
|
"aria-label": "Bold",
|
|
151
|
-
children: [/* @__PURE__ */ c("
|
|
152
|
-
className: "
|
|
153
|
-
|
|
182
|
+
children: [/* @__PURE__ */ c("span", {
|
|
183
|
+
className: "text-sm font-bold font-serif",
|
|
184
|
+
children: "B"
|
|
185
|
+
}), /* @__PURE__ */ c("span", {
|
|
186
|
+
className: o,
|
|
187
|
+
"data-i18n": "bold",
|
|
188
|
+
children: "Bold"
|
|
154
189
|
})]
|
|
155
190
|
}),
|
|
156
191
|
/* @__PURE__ */ c("button", {
|
|
157
192
|
type: "button",
|
|
158
|
-
className:
|
|
193
|
+
className: `${r} ${n ? a : i}`,
|
|
159
194
|
onClick: () => e("underline"),
|
|
160
195
|
"aria-label": "Underline",
|
|
161
|
-
children: [/* @__PURE__ */ c("
|
|
162
|
-
className: "
|
|
163
|
-
|
|
196
|
+
children: [/* @__PURE__ */ c("span", {
|
|
197
|
+
className: "text-sm font-bold font-serif underline",
|
|
198
|
+
children: "U"
|
|
199
|
+
}), /* @__PURE__ */ c("span", {
|
|
200
|
+
className: o,
|
|
201
|
+
"data-i18n": "underline",
|
|
202
|
+
children: "Underline"
|
|
164
203
|
})]
|
|
165
204
|
}),
|
|
166
205
|
/* @__PURE__ */ c("button", {
|
|
167
206
|
type: "button",
|
|
168
|
-
className:
|
|
207
|
+
className: `${r} ${i}`,
|
|
169
208
|
onClick: () => e("removeFormat"),
|
|
170
209
|
"aria-label": "Remove Font Style",
|
|
171
|
-
children: [/* @__PURE__ */ c("span", {
|
|
172
|
-
className: "
|
|
173
|
-
|
|
210
|
+
children: [/* @__PURE__ */ c("span", {
|
|
211
|
+
className: "inline-block h-4 w-4 text-center text-sm leading-none",
|
|
212
|
+
children: /* @__PURE__ */ c("svg", {
|
|
213
|
+
viewBox: "0 0 20 20",
|
|
214
|
+
className: "block h-4 w-4 fill-none stroke-black",
|
|
215
|
+
strokeWidth: "2",
|
|
216
|
+
children: /* @__PURE__ */ c("path", { d: "M 4 4 L 16 16 M 16 4 L 4 16" })
|
|
217
|
+
})
|
|
218
|
+
}), /* @__PURE__ */ c("span", {
|
|
219
|
+
className: o,
|
|
220
|
+
"data-i18n": "removeFormat",
|
|
221
|
+
children: "Remove Font Style"
|
|
174
222
|
})]
|
|
175
223
|
})
|
|
176
224
|
]
|
|
177
225
|
});
|
|
178
226
|
}
|
|
179
227
|
//#endregion
|
|
228
|
+
//#region src/components/shared/toolbar/font/Hooks/boldHandler.jsx
|
|
229
|
+
var f = (e, t, n) => {
|
|
230
|
+
if (!e.collapsed) {
|
|
231
|
+
if (n) {
|
|
232
|
+
let t = e.commonAncestorContainer;
|
|
233
|
+
for (t.nodeType === 3 && (t = t.parentNode); t && t.getAttribute && t.getAttribute("contenteditable") !== "true";) {
|
|
234
|
+
if (t.style && t.style.fontWeight) {
|
|
235
|
+
if (t.style.fontWeight = "", !t.getAttribute("style")) {
|
|
236
|
+
let e = t.parentNode;
|
|
237
|
+
for (; t.firstChild;) e.insertBefore(t.firstChild, t);
|
|
238
|
+
e.removeChild(t);
|
|
239
|
+
}
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
t = t.parentNode;
|
|
243
|
+
}
|
|
244
|
+
} else {
|
|
245
|
+
let t = e.extractContents(), n = document.createElement("span");
|
|
246
|
+
n.style.fontWeight = "bold", n.appendChild(t), e.insertNode(n);
|
|
247
|
+
}
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
if (n) {
|
|
251
|
+
let n = e.startContainer, r = n.nodeType === 1 ? n : n.parentNode;
|
|
252
|
+
for (; r && r.getAttribute && r.getAttribute("contenteditable") !== "true" && !(r.style && r.style.fontWeight);) r = r.parentNode;
|
|
253
|
+
let i = document.createElement("span");
|
|
254
|
+
i.innerHTML = "", r && r.parentNode ? r.nextSibling ? r.parentNode.insertBefore(i, r.nextSibling) : r.parentNode.appendChild(i) : e.insertNode(i);
|
|
255
|
+
let a = document.createRange();
|
|
256
|
+
a.setStart(i, 1), a.collapse(!0), t.removeAllRanges(), t.addRange(a);
|
|
257
|
+
} else {
|
|
258
|
+
let n = document.createElement("span");
|
|
259
|
+
n.style.fontWeight = "bold", n.innerHTML = "", e.insertNode(n);
|
|
260
|
+
let r = document.createRange();
|
|
261
|
+
r.setStart(n, 1), r.collapse(!0), t.removeAllRanges(), t.addRange(r);
|
|
262
|
+
}
|
|
263
|
+
}, p = (e, t, n) => {
|
|
264
|
+
if (!e.collapsed) {
|
|
265
|
+
if (n) {
|
|
266
|
+
let t = e.commonAncestorContainer;
|
|
267
|
+
for (t.nodeType === 3 && (t = t.parentNode); t && t.getAttribute && t.getAttribute("contenteditable") !== "true";) {
|
|
268
|
+
if (t.style && t.style.textDecoration) {
|
|
269
|
+
if (t.style.textDecoration = "", !t.getAttribute("style")) {
|
|
270
|
+
let e = t.parentNode;
|
|
271
|
+
for (; t.firstChild;) e.insertBefore(t.firstChild, t);
|
|
272
|
+
e.removeChild(t);
|
|
273
|
+
}
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
t = t.parentNode;
|
|
277
|
+
}
|
|
278
|
+
} else {
|
|
279
|
+
let t = e.extractContents(), n = document.createElement("span");
|
|
280
|
+
n.style.textDecoration = "underline", n.appendChild(t), e.insertNode(n);
|
|
281
|
+
}
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
if (n) {
|
|
285
|
+
let n = e.startContainer, r = n.nodeType === 1 ? n : n.parentNode;
|
|
286
|
+
for (; r && r.getAttribute && r.getAttribute("contenteditable") !== "true" && !(r.style && r.style.textDecoration);) r = r.parentNode;
|
|
287
|
+
let i = document.createElement("span");
|
|
288
|
+
i.innerHTML = "", r && r.parentNode ? r.nextSibling ? r.parentNode.insertBefore(i, r.nextSibling) : r.parentNode.appendChild(i) : e.insertNode(i);
|
|
289
|
+
let a = document.createRange();
|
|
290
|
+
a.setStart(i, 1), a.collapse(!0), t.removeAllRanges(), t.addRange(a);
|
|
291
|
+
} else {
|
|
292
|
+
let n = document.createElement("span");
|
|
293
|
+
n.style.textDecoration = "underline", n.innerHTML = "", e.insertNode(n);
|
|
294
|
+
let r = document.createRange();
|
|
295
|
+
r.setStart(n, 1), r.collapse(!0), t.removeAllRanges(), t.addRange(r);
|
|
296
|
+
}
|
|
297
|
+
}, m = (e) => {
|
|
298
|
+
let t = document.createTreeWalker(e, NodeFilter.SHOW_TEXT, null, !1), n;
|
|
299
|
+
for (; n = t.nextNode();) n.nodeValue = n.nodeValue.replace(/\u00A0/g, " ");
|
|
300
|
+
}, h = (e) => {
|
|
301
|
+
e.querySelectorAll("span, b, u, strong").forEach((e) => {
|
|
302
|
+
let t = e.getAttribute("style") || e.getAttribute("class"), n = [
|
|
303
|
+
"B",
|
|
304
|
+
"U",
|
|
305
|
+
"STRONG"
|
|
306
|
+
].includes(e.tagName);
|
|
307
|
+
if (!t && !n) {
|
|
308
|
+
let t = e.parentNode;
|
|
309
|
+
for (; e.firstChild;) t.insertBefore(e.firstChild, e);
|
|
310
|
+
t.removeChild(e);
|
|
311
|
+
} else (!e.textContent || e.textContent.replace(/\u200B/g, "").length === 0) && e.remove();
|
|
312
|
+
});
|
|
313
|
+
}, g = (e, t) => {
|
|
314
|
+
if (e.collapsed) return;
|
|
315
|
+
let n = e.commonAncestorContainer;
|
|
316
|
+
for (n.nodeType === 3 && (n = n.parentNode); n && n.getAttribute && n.getAttribute("contenteditable") !== "true";) {
|
|
317
|
+
let e = window.getComputedStyle(n).display;
|
|
318
|
+
if (e === "block" || e === "flex" || n.tagName === "PRE") break;
|
|
319
|
+
n = n.parentNode;
|
|
320
|
+
}
|
|
321
|
+
let r = e.extractContents().textContent.replace(/\u00A0/g, " "), i = document.createTextNode(r);
|
|
322
|
+
e.insertNode(i), n && n.getAttribute("contenteditable") !== "true" && (h(n), m(n), n.normalize());
|
|
323
|
+
let a = document.createRange();
|
|
324
|
+
a.selectNodeContents(i), t.removeAllRanges(), t.addRange(a);
|
|
325
|
+
};
|
|
326
|
+
//#endregion
|
|
180
327
|
//#region src/components/shared/toolbar/font/Hooks/fontLogic.jsx
|
|
181
|
-
function
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
328
|
+
function _() {
|
|
329
|
+
let [e, t] = i(!1), [r, a] = i(!1), o = () => {
|
|
330
|
+
let e = window.getSelection();
|
|
331
|
+
if (!e || e.rangeCount === 0) return;
|
|
332
|
+
let n = e.anchorNode;
|
|
333
|
+
if (!n) return;
|
|
334
|
+
n.nodeType === 3 && (n = n.parentNode);
|
|
335
|
+
let r = !1, i = !1;
|
|
336
|
+
for (; n && n.getAttribute && n.getAttribute("contenteditable") !== "true";) {
|
|
337
|
+
let e = window.getComputedStyle(n).fontWeight, t = window.getComputedStyle(n).textDecoration;
|
|
338
|
+
(e === "bold" || parseInt(e) >= 700 || n.tagName === "B" || n.tagName === "STRONG") && (r = !0), (t.includes("underline") || n.tagName === "U") && (i = !0), n = n.parentNode;
|
|
339
|
+
}
|
|
340
|
+
t(r), a(i);
|
|
341
|
+
};
|
|
342
|
+
return n(() => (document.addEventListener("selectionchange", o), () => document.removeEventListener("selectionchange", o)), []), {
|
|
343
|
+
executeCommand: (t) => {
|
|
344
|
+
let n = window.getSelection();
|
|
345
|
+
if (!n || n.rangeCount === 0) return;
|
|
346
|
+
let i = n.getRangeAt(0);
|
|
347
|
+
t === "bold" ? f(i, n, e) : t === "underline" ? p(i, n, r) : t === "removeFormat" && g(i, n), o();
|
|
348
|
+
},
|
|
349
|
+
isBold: e,
|
|
350
|
+
isUnderline: r
|
|
351
|
+
};
|
|
185
352
|
}
|
|
186
353
|
//#endregion
|
|
187
354
|
//#region src/components/shared/toolbar/font/Components/index.jsx
|
|
188
|
-
function
|
|
189
|
-
let { executeCommand: e } =
|
|
190
|
-
return /* @__PURE__ */ c(d, {
|
|
355
|
+
function v() {
|
|
356
|
+
let { executeCommand: e, isBold: t, isUnderline: n } = _();
|
|
357
|
+
return /* @__PURE__ */ c(d, {
|
|
358
|
+
onCommand: e,
|
|
359
|
+
isBold: t,
|
|
360
|
+
isUnderline: n
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
//#endregion
|
|
364
|
+
//#region src/components/shared/toolbar/FontName/Hooks/fontNameHandler.jsx
|
|
365
|
+
var y = (e, t, n) => {
|
|
366
|
+
let r = n || "Arial";
|
|
367
|
+
if (!e || !t) return;
|
|
368
|
+
if (!e.collapsed) {
|
|
369
|
+
let n = document.createElement("span");
|
|
370
|
+
n.style.fontFamily = r;
|
|
371
|
+
try {
|
|
372
|
+
n.appendChild(e.extractContents()), e.insertNode(n);
|
|
373
|
+
} catch {
|
|
374
|
+
document.execCommand("fontName", !1, r);
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
let i = document.createRange();
|
|
378
|
+
i.selectNodeContents(n), t.removeAllRanges(), t.addRange(i);
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
let i = document.createElement("span");
|
|
382
|
+
i.style.fontFamily = r;
|
|
383
|
+
let a = document.createTextNode("");
|
|
384
|
+
i.appendChild(a), e.insertNode(i);
|
|
385
|
+
let o = document.createRange();
|
|
386
|
+
o.setStart(i.firstChild, 1), o.collapse(!0), t.removeAllRanges(), t.addRange(o);
|
|
387
|
+
}, ee = (e) => {
|
|
388
|
+
let t = window.getSelection();
|
|
389
|
+
if (!t || t.rangeCount === 0) return null;
|
|
390
|
+
let n = t.anchorNode;
|
|
391
|
+
if (!n || e && !e.contains(n)) return null;
|
|
392
|
+
for (n.nodeType === 3 && (n = n.parentNode); n && n !== e;) {
|
|
393
|
+
if (n.style && n.style.fontFamily) {
|
|
394
|
+
let e = n.style.fontFamily.split(",")[0].replace(/['"]/g, "").trim();
|
|
395
|
+
if (e) return e;
|
|
396
|
+
}
|
|
397
|
+
n = n.parentNode;
|
|
398
|
+
}
|
|
399
|
+
let r = window.getComputedStyle(e).fontFamily;
|
|
400
|
+
return r ? r.split(",")[0].replace(/['"]/g, "").trim() : null;
|
|
401
|
+
};
|
|
402
|
+
//#endregion
|
|
403
|
+
//#region src/components/shared/toolbar/FontName/Hooks/fontNameLogic.jsx
|
|
404
|
+
function b(e) {
|
|
405
|
+
let [t, a] = i("Arial"), o = r("Arial"), s = r(null), c = () => {
|
|
406
|
+
let t = window.getSelection();
|
|
407
|
+
if (t && t.rangeCount > 0) {
|
|
408
|
+
let n = t.getRangeAt(0), r = e?.current;
|
|
409
|
+
r && r.contains(n.commonAncestorContainer) && (s.current = n.cloneRange());
|
|
410
|
+
}
|
|
411
|
+
}, l = () => {
|
|
412
|
+
let t = e?.current;
|
|
413
|
+
if (!t) return;
|
|
414
|
+
let n = ee(t);
|
|
415
|
+
n && (a(n), o.current = n);
|
|
416
|
+
};
|
|
417
|
+
return n(() => {
|
|
418
|
+
let t = () => {
|
|
419
|
+
c(), l();
|
|
420
|
+
};
|
|
421
|
+
document.addEventListener("selectionchange", t);
|
|
422
|
+
let n = e?.current;
|
|
423
|
+
if (!n) return () => {
|
|
424
|
+
document.removeEventListener("selectionchange", t);
|
|
425
|
+
};
|
|
426
|
+
let r = (e) => {
|
|
427
|
+
if (e.inputType !== "insertText" || !e.data) return;
|
|
428
|
+
let t = window.getSelection();
|
|
429
|
+
if (!t || t.rangeCount === 0) return;
|
|
430
|
+
let n = t.getRangeAt(0), r = n.startContainer;
|
|
431
|
+
if (r.nodeType === 3 && (r = r.parentNode), r && r.tagName === "SPAN" && r.style.fontFamily && r.style.fontFamily.replace(/['"]/g, "").toLowerCase() === o.current.toLowerCase()) return;
|
|
432
|
+
e.preventDefault();
|
|
433
|
+
let i = document.createElement("span");
|
|
434
|
+
i.style.fontFamily = o.current, i.textContent = e.data, n.deleteContents(), n.insertNode(i);
|
|
435
|
+
let a = document.createRange();
|
|
436
|
+
a.setStart(i.firstChild, i.textContent.length), a.collapse(!0), t.removeAllRanges(), t.addRange(a);
|
|
437
|
+
};
|
|
438
|
+
return n.addEventListener("beforeinput", r), () => {
|
|
439
|
+
document.removeEventListener("selectionchange", t), n.removeEventListener("beforeinput", r);
|
|
440
|
+
};
|
|
441
|
+
}, [e, e?.current]), {
|
|
442
|
+
currentFont: t,
|
|
443
|
+
applyFont: (t) => {
|
|
444
|
+
let n = t || "Arial";
|
|
445
|
+
o.current = n, a(n);
|
|
446
|
+
let r = e?.current;
|
|
447
|
+
if (!r) return;
|
|
448
|
+
r.focus();
|
|
449
|
+
let i = window.getSelection(), l = null;
|
|
450
|
+
if (s.current ? (i.removeAllRanges(), i.addRange(s.current), l = s.current) : i.rangeCount > 0 && (l = i.getRangeAt(0)), !l) {
|
|
451
|
+
let e = document.createRange();
|
|
452
|
+
e.selectNodeContents(r), e.collapse(!1), i.removeAllRanges(), i.addRange(e), l = e;
|
|
453
|
+
}
|
|
454
|
+
y(l, i, n), c();
|
|
455
|
+
}
|
|
456
|
+
};
|
|
191
457
|
}
|
|
192
458
|
//#endregion
|
|
193
459
|
//#region src/components/shared/toolbar/Hooks/dropdown.js
|
|
194
|
-
function
|
|
460
|
+
function x(e, t) {
|
|
195
461
|
function n() {
|
|
196
462
|
t.classList.remove("is-open"), e.classList.remove("is-active"), document.removeEventListener("click", r);
|
|
197
463
|
}
|
|
198
464
|
function r(r) {
|
|
199
|
-
!t.contains(r.target) && r.target
|
|
465
|
+
!t.contains(r.target) && !e.contains(r.target) && n();
|
|
200
466
|
}
|
|
201
467
|
function i(n) {
|
|
202
468
|
n.stopPropagation();
|
|
@@ -213,7 +479,7 @@ function m(e, t) {
|
|
|
213
479
|
}
|
|
214
480
|
//#endregion
|
|
215
481
|
//#region src/components/shared/toolbar/FontName/Components/FontNameToolbar.jsx
|
|
216
|
-
var
|
|
482
|
+
var S = [
|
|
217
483
|
"Arial",
|
|
218
484
|
"Arial Black",
|
|
219
485
|
"Comic Sans MS",
|
|
@@ -225,68 +491,83 @@ var h = [
|
|
|
225
491
|
"Verdana",
|
|
226
492
|
"Nunito Sans",
|
|
227
493
|
"Segoe UI"
|
|
228
|
-
];
|
|
229
|
-
function
|
|
230
|
-
let
|
|
494
|
+
], C = 32;
|
|
495
|
+
function w({ currentFont: e, applyFont: t }) {
|
|
496
|
+
let i = r(null), a = r(null);
|
|
231
497
|
n(() => {
|
|
232
|
-
if (
|
|
498
|
+
if (i.current && a.current) return x(i.current, a.current);
|
|
233
499
|
}, []);
|
|
234
|
-
let
|
|
235
|
-
|
|
236
|
-
};
|
|
500
|
+
let o = (e) => {
|
|
501
|
+
t(e), a.current && a.current.classList.remove("is-open"), i.current && i.current.classList.remove("is-active");
|
|
502
|
+
}, s = "pointer-events-none absolute left-1/2 top-[calc(100%+8px)] z-30 -translate-x-1/2 whitespace-nowrap rounded-md border border-[#2c2c2c] bg-[#1e1e1e] px-2.5 py-1 text-[11px] font-medium leading-none text-white opacity-0 shadow-lg transition-all duration-200 group-hover:visible group-hover:opacity-100 rtl:left-1/2 rtl:-translate-x-1/2 before:absolute before:bottom-full before:left-1/2 before:-translate-x-1/2 before:border-x-[5px] before:border-b-[5px] before:border-t-0 before:border-solid before:border-x-transparent before:border-b-[#2c2c2c] after:absolute after:bottom-full after:left-1/2 after:-translate-x-1/2 after:translate-y-[1px] after:border-x-[4px] after:border-b-[4px] after:border-t-0 after:border-solid after:border-x-transparent after:border-b-[#1e1e1e]";
|
|
237
503
|
return /* @__PURE__ */ c("div", {
|
|
238
|
-
className: "forge-toolbar-group forge-toolbar-fontname",
|
|
239
|
-
children: [/* @__PURE__ */ c("
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
504
|
+
className: "forge-toolbar-group forge-toolbar-fontname relative flex items-center",
|
|
505
|
+
children: [/* @__PURE__ */ c("div", {
|
|
506
|
+
className: "forge-color-button-group flex h-[30px] items-center overflow-visible rounded border border-[#ccc] bg-white hover:border-[#aaa] hover:bg-[#f9f9f9]",
|
|
507
|
+
children: [/* @__PURE__ */ c("button", {
|
|
508
|
+
type: "button",
|
|
509
|
+
className: "forge-fontname-main group relative flex h-full items-center justify-center min-w-[70px] cursor-pointer border-none bg-transparent px-2 hover:bg-black/5",
|
|
510
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
511
|
+
onClick: () => {
|
|
512
|
+
i.current && i.current.click();
|
|
513
|
+
},
|
|
514
|
+
"aria-label": "Current font",
|
|
515
|
+
children: [/* @__PURE__ */ c("span", {
|
|
516
|
+
className: "forge-current-fontname max-w-[65px] truncate text-xs text-[#333]",
|
|
517
|
+
style: { fontFamily: e },
|
|
518
|
+
children: e
|
|
519
|
+
}), /* @__PURE__ */ c("span", {
|
|
520
|
+
className: s,
|
|
521
|
+
"data-i18n": "fontName",
|
|
522
|
+
children: "Font Family"
|
|
523
|
+
})]
|
|
524
|
+
}), /* @__PURE__ */ c("button", {
|
|
525
|
+
ref: i,
|
|
526
|
+
type: "button",
|
|
527
|
+
className: "forge-fontname-dropdown-btn group relative flex h-full items-center justify-center min-w-[18px] cursor-pointer border-l border-[#ccc] bg-transparent px-1 hover:bg-black/5",
|
|
528
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
529
|
+
"aria-label": "More fonts",
|
|
530
|
+
children: [/* @__PURE__ */ c(() => /* @__PURE__ */ c("svg", {
|
|
531
|
+
className: "h-2 w-2 fill-current text-[#666]",
|
|
532
|
+
viewBox: "0 0 10 6",
|
|
533
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
534
|
+
children: /* @__PURE__ */ c("path", { d: "M0 0l5 6 5-6H0z" })
|
|
535
|
+
}), {}), /* @__PURE__ */ c("span", {
|
|
536
|
+
className: s,
|
|
537
|
+
"data-i18n": "moreFont",
|
|
538
|
+
children: "More Fonts"
|
|
539
|
+
})]
|
|
251
540
|
})]
|
|
252
541
|
}), /* @__PURE__ */ c("div", {
|
|
253
|
-
ref:
|
|
254
|
-
className: "forge-toolbar-dropdown forge-dropdown-fontname",
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
className: "forge-dropdown-item",
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
style: { fontFamily: e },
|
|
263
|
-
onClick: (t) => {
|
|
264
|
-
t.preventDefault(), s(e);
|
|
542
|
+
ref: a,
|
|
543
|
+
className: "forge-toolbar-dropdown forge-dropdown-fontname absolute left-0 top-full z-20 hidden mt-1 min-w-[150px] overflow-y-auto rounded border border-[#ccc] bg-white p-1 shadow-md rtl:left-auto rtl:right-0 [&.is-open]:block",
|
|
544
|
+
style: { maxHeight: "128px" },
|
|
545
|
+
children: S.map((e) => /* @__PURE__ */ c("button", {
|
|
546
|
+
type: "button",
|
|
547
|
+
className: "forge-dropdown-item flex w-full cursor-pointer items-center whitespace-nowrap rounded-sm px-2 text-left text-xs text-[#333] hover:bg-[#f0f0f0]",
|
|
548
|
+
style: {
|
|
549
|
+
fontFamily: e,
|
|
550
|
+
height: `${C}px`
|
|
265
551
|
},
|
|
552
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
553
|
+
onClick: () => o(e),
|
|
266
554
|
children: e
|
|
267
555
|
}, e))
|
|
268
556
|
})]
|
|
269
557
|
});
|
|
270
558
|
}
|
|
271
559
|
//#endregion
|
|
272
|
-
//#region src/components/shared/toolbar/FontName/Hooks/fontNameLogic.jsx
|
|
273
|
-
function _() {
|
|
274
|
-
let [e, t] = i("Nunito Sans");
|
|
275
|
-
return {
|
|
276
|
-
currentFont: e,
|
|
277
|
-
applyFont: (e) => {
|
|
278
|
-
document.execCommand("fontName", !1, e), t(e);
|
|
279
|
-
}
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
//#endregion
|
|
283
560
|
//#region src/components/shared/toolbar/FontName/Components/index.jsx
|
|
284
|
-
function
|
|
285
|
-
|
|
561
|
+
function T({ editorRef: e }) {
|
|
562
|
+
let { currentFont: t, applyFont: n } = b(e);
|
|
563
|
+
return /* @__PURE__ */ c(w, {
|
|
564
|
+
currentFont: t,
|
|
565
|
+
applyFont: n
|
|
566
|
+
});
|
|
286
567
|
}
|
|
287
568
|
//#endregion
|
|
288
569
|
//#region src/components/shared/toolbar/Color/Components/colorPalette.jsx
|
|
289
|
-
var
|
|
570
|
+
var E = [
|
|
290
571
|
[
|
|
291
572
|
"#000000",
|
|
292
573
|
"#424242",
|
|
@@ -368,151 +649,163 @@ var y = [
|
|
|
368
649
|
"#4A1031"
|
|
369
650
|
]
|
|
370
651
|
];
|
|
371
|
-
function
|
|
652
|
+
function D({ event: e, onApply: t, currentColor: n }) {
|
|
372
653
|
return /* @__PURE__ */ c("div", {
|
|
373
|
-
className: "forge-color-palette",
|
|
374
|
-
children:
|
|
375
|
-
className: "forge-color-row",
|
|
376
|
-
children:
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
654
|
+
className: "forge-color-palette flex flex-col gap-1",
|
|
655
|
+
children: E.map((r, i) => /* @__PURE__ */ c("div", {
|
|
656
|
+
className: "forge-color-row flex gap-1 justify-between",
|
|
657
|
+
children: r.map((r) => {
|
|
658
|
+
let i = n?.toLowerCase() === r.toLowerCase();
|
|
659
|
+
return /* @__PURE__ */ c("button", {
|
|
660
|
+
type: "button",
|
|
661
|
+
title: r,
|
|
662
|
+
className: `forge-color-button h-4 w-4 cursor-pointer rounded-[2px] border p-0 hover:scale-110 hover:border-black transition-transform ${i ? "border-2 border-black" : "border-[#ccc]"}`,
|
|
663
|
+
style: { backgroundColor: r },
|
|
664
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
665
|
+
onClick: () => t(e, r),
|
|
666
|
+
"aria-label": r,
|
|
667
|
+
"aria-pressed": i
|
|
668
|
+
}, r);
|
|
669
|
+
})
|
|
670
|
+
}, i))
|
|
385
671
|
});
|
|
386
672
|
}
|
|
387
673
|
//#endregion
|
|
388
674
|
//#region src/components/shared/toolbar/Color/Components/ColorToolbar.jsx
|
|
389
|
-
function
|
|
675
|
+
function te({ logic: e }) {
|
|
390
676
|
let { applyColor: t, applyRecentColor: i, resetColor: a, recentForeColor: o, recentBackColor: s } = e, l = r(null), u = r(null), d = r(null), f = r(null);
|
|
391
|
-
|
|
392
|
-
if (l.current && u.current) return
|
|
677
|
+
n(() => {
|
|
678
|
+
if (l.current && u.current) return x(l.current, u.current);
|
|
393
679
|
}, []), n(() => {
|
|
394
|
-
if (d.current && f.current) return
|
|
395
|
-
}, [])
|
|
396
|
-
|
|
680
|
+
if (d.current && f.current) return x(d.current, f.current);
|
|
681
|
+
}, []);
|
|
682
|
+
let p = (e, n) => {
|
|
683
|
+
t(e, n), u.current && u.current.classList.remove("is-open"), l.current && l.current.classList.remove("is-active");
|
|
684
|
+
}, m = (e, n) => {
|
|
685
|
+
t(e, n), f.current && f.current.classList.remove("is-open"), d.current && d.current.classList.remove("is-active");
|
|
686
|
+
}, h = () => {
|
|
687
|
+
a("foreColor"), u.current && u.current.classList.remove("is-open"), l.current && l.current.classList.remove("is-active");
|
|
688
|
+
}, g = () => {
|
|
689
|
+
a("backColor"), f.current && f.current.classList.remove("is-open"), d.current && d.current.classList.remove("is-active");
|
|
690
|
+
}, _ = "pointer-events-none absolute left-1/2 top-[calc(100%+8px)] z-30 -translate-x-1/2 whitespace-nowrap rounded-md border border-[#2c2c2c] bg-[#1e1e1e] px-2.5 py-1 text-[11px] font-medium leading-none text-white opacity-0 shadow-lg transition-all duration-200 group-hover:visible group-hover:opacity-100 group-has-[.is-open]:hidden rtl:left-1/2 rtl:-translate-x-1/2 before:absolute before:bottom-full before:left-1/2 before:-translate-x-1/2 before:border-x-[5px] before:border-b-[5px] before:border-t-0 before:border-solid before:border-x-transparent before:border-b-[#2c2c2c] after:absolute after:bottom-full after:left-1/2 after:-translate-x-1/2 after:translate-y-[1px] after:border-x-[4px] after:border-b-[4px] after:border-t-0 after:border-solid after:border-x-transparent after:border-b-[#1e1e1e]", v = () => /* @__PURE__ */ c("svg", {
|
|
691
|
+
className: "h-2 w-2 fill-current text-[#666]",
|
|
692
|
+
viewBox: "0 0 10 6",
|
|
693
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
694
|
+
children: /* @__PURE__ */ c("path", { d: "M0 0l5 6 5-6H0z" })
|
|
695
|
+
});
|
|
696
|
+
return /* @__PURE__ */ c("div", {
|
|
697
|
+
className: "forge-toolbar-group forge-toolbar-color flex items-center gap-1",
|
|
397
698
|
children: [/* @__PURE__ */ c("div", {
|
|
398
|
-
className: "forge-color-item",
|
|
699
|
+
className: "forge-color-item relative flex items-center",
|
|
399
700
|
children: [/* @__PURE__ */ c("div", {
|
|
400
|
-
className: "forge-color-button-group",
|
|
701
|
+
className: "forge-color-button-group flex h-[30px] items-center overflow-visible rounded border border-[#ccc] bg-white hover:border-[#aaa] hover:bg-[#f9f9f9]",
|
|
401
702
|
children: [/* @__PURE__ */ c("button", {
|
|
402
703
|
type: "button",
|
|
403
|
-
className: "forge-color-main
|
|
704
|
+
className: "forge-color-main group relative flex h-full items-center justify-center min-w-[28px] cursor-pointer border-none bg-transparent p-0 hover:bg-black/5",
|
|
404
705
|
onMouseDown: (e) => e.preventDefault(),
|
|
405
706
|
onClick: () => i("foreColor"),
|
|
406
707
|
"aria-label": "Apply text color",
|
|
407
708
|
children: [/* @__PURE__ */ c("span", {
|
|
408
|
-
className: "forge-recent-color",
|
|
709
|
+
className: "forge-recent-color flex h-5 w-5 items-center justify-center rounded-[2px] border border-[#ccc] text-xs font-bold",
|
|
409
710
|
style: {
|
|
410
711
|
backgroundColor: "transparent",
|
|
411
712
|
color: o
|
|
412
713
|
},
|
|
413
714
|
children: "A"
|
|
414
715
|
}), /* @__PURE__ */ c("span", {
|
|
415
|
-
className:
|
|
716
|
+
className: _,
|
|
416
717
|
"data-i18n": "recentColor",
|
|
417
718
|
children: "Recent Color"
|
|
418
719
|
})]
|
|
419
720
|
}), /* @__PURE__ */ c("button", {
|
|
420
721
|
ref: l,
|
|
421
722
|
type: "button",
|
|
422
|
-
className: "forge-color-dropdown-btn
|
|
723
|
+
className: "forge-color-dropdown-btn group relative flex h-full items-center justify-center min-w-[18px] cursor-pointer border-l border-[#ccc] bg-transparent px-1 hover:bg-black/5",
|
|
423
724
|
onMouseDown: (e) => e.preventDefault(),
|
|
424
725
|
"aria-label": "More text colors",
|
|
425
|
-
children: [
|
|
426
|
-
className:
|
|
726
|
+
children: [/* @__PURE__ */ c(v, {}), /* @__PURE__ */ c("span", {
|
|
727
|
+
className: _,
|
|
427
728
|
"data-i18n": "moreColor",
|
|
428
729
|
children: "More Color"
|
|
429
730
|
})]
|
|
430
731
|
})]
|
|
431
732
|
}), /* @__PURE__ */ c("div", {
|
|
432
733
|
ref: u,
|
|
433
|
-
className: "forge-toolbar-dropdown forge-dropdown-color",
|
|
734
|
+
className: "forge-toolbar-dropdown forge-dropdown-color absolute left-0 top-full z-20 hidden mt-1 max-h-[220px] min-w-[180px] overflow-y-auto rounded border border-[#ccc] bg-white p-2 shadow-md rtl:left-auto rtl:right-0 [&.is-open]:block",
|
|
434
735
|
children: /* @__PURE__ */ c("div", {
|
|
435
736
|
className: "forge-color-section",
|
|
436
737
|
children: [/* @__PURE__ */ c("div", {
|
|
437
|
-
className: "forge-color-section-header",
|
|
738
|
+
className: "forge-color-section-header mb-1.5 flex items-center justify-between",
|
|
438
739
|
children: [/* @__PURE__ */ c("span", {
|
|
439
|
-
className: "forge-color-title",
|
|
740
|
+
className: "forge-color-title text-xs font-bold text-[#333]",
|
|
440
741
|
children: "Text Color"
|
|
441
742
|
}), /* @__PURE__ */ c("button", {
|
|
442
743
|
type: "button",
|
|
443
|
-
className: "forge-color-reset",
|
|
744
|
+
className: "forge-color-reset cursor-pointer rounded border border-[#ccc] bg-[#f5f5f5] px-2 py-0.5 text-[11px] font-medium text-[#333] hover:border-[#999] hover:bg-[#e6e6e6]",
|
|
444
745
|
onMouseDown: (e) => e.preventDefault(),
|
|
445
|
-
onClick:
|
|
446
|
-
a("foreColor"), u.current && u.current.classList.remove("is-open"), l.current && l.current.classList.remove("is-active");
|
|
447
|
-
},
|
|
746
|
+
onClick: h,
|
|
448
747
|
children: "Reset"
|
|
449
748
|
})]
|
|
450
|
-
}), /* @__PURE__ */ c(
|
|
749
|
+
}), /* @__PURE__ */ c(D, {
|
|
451
750
|
event: "foreColor",
|
|
452
|
-
onApply:
|
|
453
|
-
t(e, n), u.current && u.current.classList.remove("is-open"), l.current && l.current.classList.remove("is-active");
|
|
454
|
-
}
|
|
751
|
+
onApply: p
|
|
455
752
|
})]
|
|
456
753
|
})
|
|
457
754
|
})]
|
|
458
755
|
}), /* @__PURE__ */ c("div", {
|
|
459
|
-
className: "forge-color-item",
|
|
756
|
+
className: "forge-color-item relative flex items-center",
|
|
460
757
|
children: [/* @__PURE__ */ c("div", {
|
|
461
|
-
className: "forge-color-button-group",
|
|
758
|
+
className: "forge-color-button-group flex h-[30px] items-center overflow-visible rounded border border-[#ccc] bg-white hover:border-[#aaa] hover:bg-[#f9f9f9]",
|
|
462
759
|
children: [/* @__PURE__ */ c("button", {
|
|
463
760
|
type: "button",
|
|
464
|
-
className: "forge-color-main
|
|
761
|
+
className: "forge-color-main group relative flex h-full items-center justify-center min-w-[28px] cursor-pointer border-none bg-transparent p-0 hover:bg-black/5",
|
|
465
762
|
onMouseDown: (e) => e.preventDefault(),
|
|
466
763
|
onClick: () => i("backColor"),
|
|
467
764
|
"aria-label": "Apply background color",
|
|
468
765
|
children: [/* @__PURE__ */ c("span", {
|
|
469
|
-
className: "forge-recent-color",
|
|
766
|
+
className: "forge-recent-color flex h-5 w-5 items-center justify-center rounded-[2px] border border-[#ccc] text-xs font-bold",
|
|
470
767
|
style: {
|
|
471
|
-
backgroundColor: s,
|
|
768
|
+
backgroundColor: s || "#FFFFFF",
|
|
472
769
|
color: "#000"
|
|
473
770
|
},
|
|
474
771
|
children: "A"
|
|
475
772
|
}), /* @__PURE__ */ c("span", {
|
|
476
|
-
className:
|
|
773
|
+
className: _,
|
|
477
774
|
"data-i18n": "recentBackColor",
|
|
478
775
|
children: "Recent Background Color"
|
|
479
776
|
})]
|
|
480
777
|
}), /* @__PURE__ */ c("button", {
|
|
481
778
|
ref: d,
|
|
482
779
|
type: "button",
|
|
483
|
-
className: "forge-color-dropdown-btn
|
|
780
|
+
className: "forge-color-dropdown-btn group relative flex h-full items-center justify-center min-w-[18px] cursor-pointer border-l border-[#ccc] bg-transparent px-1 hover:bg-black/5",
|
|
484
781
|
onMouseDown: (e) => e.preventDefault(),
|
|
485
782
|
"aria-label": "More background colors",
|
|
486
|
-
children: [
|
|
487
|
-
className:
|
|
783
|
+
children: [/* @__PURE__ */ c(v, {}), /* @__PURE__ */ c("span", {
|
|
784
|
+
className: _,
|
|
488
785
|
"data-i18n": "moreBackColor",
|
|
489
786
|
children: "More Background Colors"
|
|
490
787
|
})]
|
|
491
788
|
})]
|
|
492
789
|
}), /* @__PURE__ */ c("div", {
|
|
493
790
|
ref: f,
|
|
494
|
-
className: "forge-toolbar-dropdown forge-dropdown-color",
|
|
791
|
+
className: "forge-toolbar-dropdown forge-dropdown-color absolute left-0 top-full z-20 hidden mt-1 max-h-[220px] min-w-[180px] overflow-y-auto rounded border border-[#ccc] bg-white p-2 shadow-md rtl:left-auto rtl:right-0 [&.is-open]:block",
|
|
495
792
|
children: /* @__PURE__ */ c("div", {
|
|
496
793
|
className: "forge-color-section",
|
|
497
794
|
children: [/* @__PURE__ */ c("div", {
|
|
498
|
-
className: "forge-color-section-header",
|
|
795
|
+
className: "forge-color-section-header mb-1.5 flex items-center justify-between",
|
|
499
796
|
children: [/* @__PURE__ */ c("span", {
|
|
500
|
-
className: "forge-color-title",
|
|
797
|
+
className: "forge-color-title text-xs font-bold text-[#333]",
|
|
501
798
|
children: "Background Color"
|
|
502
799
|
}), /* @__PURE__ */ c("button", {
|
|
503
800
|
type: "button",
|
|
504
|
-
className: "forge-color-reset",
|
|
801
|
+
className: "forge-color-reset cursor-pointer rounded border border-[#ccc] bg-[#f5f5f5] px-2 py-0.5 text-[11px] font-medium text-[#333] hover:border-[#999] hover:bg-[#e6e6e6]",
|
|
505
802
|
onMouseDown: (e) => e.preventDefault(),
|
|
506
|
-
onClick:
|
|
507
|
-
|
|
508
|
-
},
|
|
509
|
-
children: "Transparent"
|
|
803
|
+
onClick: g,
|
|
804
|
+
children: "White"
|
|
510
805
|
})]
|
|
511
|
-
}), /* @__PURE__ */ c(
|
|
806
|
+
}), /* @__PURE__ */ c(D, {
|
|
512
807
|
event: "backColor",
|
|
513
|
-
onApply:
|
|
514
|
-
t(e, n), f.current && f.current.classList.remove("is-open"), d.current && d.current.classList.remove("is-active");
|
|
515
|
-
}
|
|
808
|
+
onApply: m
|
|
516
809
|
})]
|
|
517
810
|
})
|
|
518
811
|
})]
|
|
@@ -521,23 +814,23 @@ function x({ logic: e }) {
|
|
|
521
814
|
}
|
|
522
815
|
//#endregion
|
|
523
816
|
//#region src/components/shared/toolbar/Color/Hooks/colorUtils.jsx
|
|
524
|
-
function
|
|
817
|
+
function O(e) {
|
|
525
818
|
let t = document.createElement("span");
|
|
526
819
|
t.style.color = e, document.body.appendChild(t);
|
|
527
820
|
let n = window.getComputedStyle(t).color;
|
|
528
821
|
return document.body.removeChild(t), n;
|
|
529
822
|
}
|
|
530
|
-
function
|
|
823
|
+
function ne(e, t) {
|
|
531
824
|
let n = e;
|
|
532
825
|
for (; n && n !== document.body;) {
|
|
533
|
-
if (n.nodeType === Node.ELEMENT_NODE && n.tagName === "SPAN" && n.style.color &&
|
|
826
|
+
if (n.nodeType === Node.ELEMENT_NODE && n.tagName === "SPAN" && n.style.color && O(n.style.color) === t) return n;
|
|
534
827
|
n = n.parentElement;
|
|
535
828
|
}
|
|
536
829
|
return null;
|
|
537
830
|
}
|
|
538
831
|
//#endregion
|
|
539
832
|
//#region src/components/shared/toolbar/Color/Hooks/usePenMode.jsx
|
|
540
|
-
function
|
|
833
|
+
function re(e, t) {
|
|
541
834
|
n(() => {
|
|
542
835
|
function n(n) {
|
|
543
836
|
if (n.inputType !== "insertText" || !n.data || !e.current) return;
|
|
@@ -547,9 +840,9 @@ function w(e, t) {
|
|
|
547
840
|
if (!i || !i.rangeCount) return;
|
|
548
841
|
let a = i.getRangeAt(0);
|
|
549
842
|
if (!a.collapsed) return;
|
|
550
|
-
let o =
|
|
843
|
+
let o = O(e.current), s = a.startContainer;
|
|
551
844
|
s.nodeType === Node.TEXT_NODE && (s = s.parentElement);
|
|
552
|
-
let c =
|
|
845
|
+
let c = ne(s, o);
|
|
553
846
|
if (n.preventDefault(), c) {
|
|
554
847
|
let e = document.createTextNode(n.data);
|
|
555
848
|
a.insertNode(e), a.setStartAfter(e), a.collapse(!0), i.removeAllRanges(), i.addRange(a);
|
|
@@ -564,13 +857,30 @@ function w(e, t) {
|
|
|
564
857
|
}, []);
|
|
565
858
|
}
|
|
566
859
|
//#endregion
|
|
860
|
+
//#region src/components/shared/toolbar/Color/Hooks/foreColorHandler.jsx
|
|
861
|
+
var ie = (e, t, n) => {
|
|
862
|
+
let r = n || "#000000";
|
|
863
|
+
if (!e) return;
|
|
864
|
+
if (!e.collapsed) {
|
|
865
|
+
let n = e.extractContents(), i = document.createElement("span");
|
|
866
|
+
i.style.color = r, i.appendChild(n), e.insertNode(i);
|
|
867
|
+
let a = document.createRange();
|
|
868
|
+
a.selectNodeContents(i), t.removeAllRanges(), t.addRange(a);
|
|
869
|
+
return;
|
|
870
|
+
}
|
|
871
|
+
let i = document.createElement("span");
|
|
872
|
+
i.style.color = r, i.appendChild(document.createTextNode("")), e.insertNode(i);
|
|
873
|
+
let a = document.createRange();
|
|
874
|
+
a.setStart(i.firstChild, 1), a.collapse(!0), t.removeAllRanges(), t.addRange(a);
|
|
875
|
+
};
|
|
876
|
+
//#endregion
|
|
567
877
|
//#region src/components/shared/toolbar/Color/Hooks/useForeColor.jsx
|
|
568
|
-
function
|
|
878
|
+
function ae(e = "forge-editor__content") {
|
|
569
879
|
let [t, n] = i("#000000"), a = r(null);
|
|
570
|
-
|
|
880
|
+
re(a, e);
|
|
571
881
|
let o = (e) => {
|
|
572
|
-
let t = window.getSelection();
|
|
573
|
-
|
|
882
|
+
let t = e || "#000000", r = window.getSelection();
|
|
883
|
+
r && r.rangeCount > 0 && ie(r.getRangeAt(0), r, t), a.current = t, n(t);
|
|
574
884
|
};
|
|
575
885
|
return {
|
|
576
886
|
recentForeColor: t,
|
|
@@ -579,31 +889,72 @@ function T(e = "forge-editor__content") {
|
|
|
579
889
|
o(t);
|
|
580
890
|
},
|
|
581
891
|
resetForeColor: () => {
|
|
582
|
-
|
|
892
|
+
o("#000000"), a.current = null;
|
|
583
893
|
}
|
|
584
894
|
};
|
|
585
895
|
}
|
|
586
896
|
//#endregion
|
|
897
|
+
//#region src/components/shared/toolbar/Color/Hooks/usePenModeBack.jsx
|
|
898
|
+
function k(e, t) {
|
|
899
|
+
n(() => {
|
|
900
|
+
let n = (n) => {
|
|
901
|
+
if (!e.current || n.inputType !== "insertText" || !n.data) return;
|
|
902
|
+
let r = window.getSelection();
|
|
903
|
+
if (!r || !r.rangeCount) return;
|
|
904
|
+
let i = r.getRangeAt(0);
|
|
905
|
+
if (!(i.startContainer.nodeType === 1 ? i.startContainer.closest(`.${t}`) : i.startContainer.parentElement?.closest(`.${t}`))) return;
|
|
906
|
+
n.preventDefault();
|
|
907
|
+
let a = document.createElement("span");
|
|
908
|
+
a.style.backgroundColor = e.current, a.textContent = n.data, i.deleteContents(), i.insertNode(a);
|
|
909
|
+
let o = document.createRange();
|
|
910
|
+
o.setStartAfter(a), o.collapse(!0), r.removeAllRanges(), r.addRange(o);
|
|
911
|
+
};
|
|
912
|
+
return document.addEventListener("beforeinput", n, !0), () => {
|
|
913
|
+
document.removeEventListener("beforeinput", n, !0);
|
|
914
|
+
};
|
|
915
|
+
}, [t, e]);
|
|
916
|
+
}
|
|
917
|
+
//#endregion
|
|
918
|
+
//#region src/components/shared/toolbar/Color/Hooks/backColorHandler.jsx
|
|
919
|
+
var A = (e, t, n) => {
|
|
920
|
+
let r = n || "#FFFFFF";
|
|
921
|
+
if (!e) return;
|
|
922
|
+
if (!e.collapsed) {
|
|
923
|
+
let n = e.extractContents(), i = document.createElement("span");
|
|
924
|
+
i.style.backgroundColor = r, i.appendChild(n), e.insertNode(i);
|
|
925
|
+
let a = document.createRange();
|
|
926
|
+
a.selectNodeContents(i), t.removeAllRanges(), t.addRange(a);
|
|
927
|
+
return;
|
|
928
|
+
}
|
|
929
|
+
let i = document.createElement("span");
|
|
930
|
+
i.style.backgroundColor = r, i.appendChild(document.createTextNode("")), e.insertNode(i);
|
|
931
|
+
let a = document.createRange();
|
|
932
|
+
a.setStart(i.firstChild, 1), a.collapse(!0), t.removeAllRanges(), t.addRange(a);
|
|
933
|
+
};
|
|
934
|
+
//#endregion
|
|
587
935
|
//#region src/components/shared/toolbar/Color/Hooks/useBackColor.jsx
|
|
588
|
-
function
|
|
589
|
-
let [
|
|
936
|
+
function oe(e = "forge-editor__content") {
|
|
937
|
+
let [t, n] = i("#FFFFFF"), a = r(null);
|
|
938
|
+
k(a, e);
|
|
939
|
+
let o = (e) => {
|
|
940
|
+
let t = e || "#FFFFFF", r = window.getSelection();
|
|
941
|
+
r && r.rangeCount > 0 && A(r.getRangeAt(0), r, t), a.current = t, n(t);
|
|
942
|
+
};
|
|
590
943
|
return {
|
|
591
|
-
recentBackColor:
|
|
592
|
-
applyBackColor:
|
|
593
|
-
document.execCommand("styleWithCSS", !1, !0), document.execCommand("backColor", !1, e), t(e);
|
|
594
|
-
},
|
|
944
|
+
recentBackColor: t,
|
|
945
|
+
applyBackColor: o,
|
|
595
946
|
applyRecentBackColor: () => {
|
|
596
|
-
|
|
947
|
+
o(t);
|
|
597
948
|
},
|
|
598
949
|
resetBackColor: () => {
|
|
599
|
-
|
|
950
|
+
o("#FFFFFF"), a.current = null;
|
|
600
951
|
}
|
|
601
952
|
};
|
|
602
953
|
}
|
|
603
954
|
//#endregion
|
|
604
955
|
//#region src/components/shared/toolbar/Color/Hooks/colorLogic.jsx
|
|
605
|
-
function
|
|
606
|
-
let e =
|
|
956
|
+
function se() {
|
|
957
|
+
let e = ae(), t = oe();
|
|
607
958
|
return {
|
|
608
959
|
applyColor: (n, r) => {
|
|
609
960
|
n === "foreColor" ? e.applyForeColor(r) : n === "backColor" && t.applyBackColor(r);
|
|
@@ -620,369 +971,421 @@ function D() {
|
|
|
620
971
|
}
|
|
621
972
|
//#endregion
|
|
622
973
|
//#region src/components/shared/toolbar/Color/Components/index.jsx
|
|
623
|
-
function
|
|
624
|
-
return
|
|
974
|
+
function ce() {
|
|
975
|
+
return /* @__PURE__ */ c(te, { logic: se() });
|
|
625
976
|
}
|
|
626
977
|
//#endregion
|
|
627
978
|
//#region src/components/shared/toolbar/Paragraph/Components/ParagraphToolbar.jsx
|
|
628
|
-
function
|
|
629
|
-
let {
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
979
|
+
function le({ logic: e = {} }) {
|
|
980
|
+
let { saveSelectionRange: t, toggleUnorderedList: a, toggleOrderedList: o, setAlignment: s, outdent: l, indent: u } = e, [d, f] = i(!1), p = r(null);
|
|
981
|
+
n(() => {
|
|
982
|
+
let e = (e) => {
|
|
983
|
+
p.current && !p.current.contains(e.target) && f(!1);
|
|
984
|
+
};
|
|
985
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
986
|
+
}, []);
|
|
987
|
+
let m = (e, n, r = null) => {
|
|
988
|
+
e.preventDefault(), typeof t == "function" && t(), typeof n == "function" && n(r);
|
|
989
|
+
}, h = "forge-toolbar-button group relative flex h-8 items-center justify-center bg-white px-2.5 text-sm transition-all duration-150 hover:bg-[#f5f5f5] active:bg-[#e8e8e8] focus:outline-none", g = "forge-toolbar-icon inline-block h-4 w-4", _ = "pointer-events-none absolute left-1/2 top-[calc(100%+8px)] z-30 -translate-x-1/2 whitespace-nowrap rounded-md border border-[#2c2c2c] bg-[#1e1e1e] px-2.5 py-1 text-[11px] font-medium leading-none text-white opacity-0 shadow-lg transition-all duration-200 group-hover:visible group-hover:opacity-100 rtl:left-1/2 rtl:-translate-x-1/2 before:absolute before:bottom-full before:left-1/2 before:-translate-x-1/2 before:border-x-[5px] before:border-b-[5px] before:border-t-0 before:border-solid before:border-x-transparent before:border-b-[#2c2c2c] after:absolute after:bottom-full after:left-1/2 after:-translate-x-1/2 after:translate-y-[1px] after:border-x-[4px] after:border-b-[4px] after:border-t-0 after:border-solid after:border-x-transparent after:border-b-[#1e1e1e]", v = "group relative flex h-7 w-7 items-center justify-center rounded hover:bg-gray-100";
|
|
990
|
+
return /* @__PURE__ */ c("div", {
|
|
991
|
+
ref: p,
|
|
992
|
+
className: "forge-toolbar-group forge-toolbar-paragraph relative inline-flex items-center text-black",
|
|
634
993
|
children: [
|
|
635
|
-
/* @__PURE__ */ c("
|
|
636
|
-
|
|
637
|
-
className: "
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
994
|
+
/* @__PURE__ */ c("style", { children: "\n .forge-toolbar-paragraph svg * {\n vector-effect: non-scaling-stroke;\n }\n " }),
|
|
995
|
+
/* @__PURE__ */ c("div", {
|
|
996
|
+
className: "inline-flex rounded-md border border-[#d1d5db] bg-white shadow-sm -space-x-px",
|
|
997
|
+
children: [
|
|
998
|
+
/* @__PURE__ */ c("button", {
|
|
999
|
+
type: "button",
|
|
1000
|
+
className: h,
|
|
1001
|
+
onMouseDown: (e) => m(e, a),
|
|
1002
|
+
"aria-label": "Unordered list",
|
|
1003
|
+
children: [/* @__PURE__ */ c("span", {
|
|
1004
|
+
className: g,
|
|
1005
|
+
children: /* @__PURE__ */ c("svg", {
|
|
1006
|
+
viewBox: "0 0 20 20",
|
|
1007
|
+
className: "block h-4 w-4",
|
|
1008
|
+
children: [
|
|
1009
|
+
/* @__PURE__ */ c("circle", {
|
|
1010
|
+
cx: "3",
|
|
1011
|
+
cy: "5",
|
|
1012
|
+
r: "1.5",
|
|
1013
|
+
fill: "black"
|
|
1014
|
+
}),
|
|
1015
|
+
/* @__PURE__ */ c("circle", {
|
|
1016
|
+
cx: "3",
|
|
1017
|
+
cy: "10",
|
|
1018
|
+
r: "1.5",
|
|
1019
|
+
fill: "black"
|
|
1020
|
+
}),
|
|
1021
|
+
/* @__PURE__ */ c("circle", {
|
|
1022
|
+
cx: "3",
|
|
1023
|
+
cy: "15",
|
|
1024
|
+
r: "1.5",
|
|
1025
|
+
fill: "black"
|
|
1026
|
+
}),
|
|
1027
|
+
/* @__PURE__ */ c("rect", {
|
|
1028
|
+
x: "7",
|
|
1029
|
+
y: "4",
|
|
1030
|
+
width: "11",
|
|
1031
|
+
height: "2",
|
|
1032
|
+
rx: "1",
|
|
1033
|
+
fill: "black"
|
|
1034
|
+
}),
|
|
1035
|
+
/* @__PURE__ */ c("rect", {
|
|
1036
|
+
x: "7",
|
|
1037
|
+
y: "9",
|
|
1038
|
+
width: "11",
|
|
1039
|
+
height: "2",
|
|
1040
|
+
rx: "1",
|
|
1041
|
+
fill: "black"
|
|
1042
|
+
}),
|
|
1043
|
+
/* @__PURE__ */ c("rect", {
|
|
1044
|
+
x: "7",
|
|
1045
|
+
y: "14",
|
|
1046
|
+
width: "11",
|
|
1047
|
+
height: "2",
|
|
1048
|
+
rx: "1",
|
|
1049
|
+
fill: "black"
|
|
1050
|
+
})
|
|
1051
|
+
]
|
|
682
1052
|
})
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
1053
|
+
}), /* @__PURE__ */ c("span", {
|
|
1054
|
+
className: _,
|
|
1055
|
+
"data-i18n": "unorderedList",
|
|
1056
|
+
children: "Bullet list"
|
|
1057
|
+
})]
|
|
1058
|
+
}),
|
|
1059
|
+
/* @__PURE__ */ c("div", { className: "w-[1px] bg-[#e5e7eb] my-1" }),
|
|
1060
|
+
/* @__PURE__ */ c("button", {
|
|
1061
|
+
type: "button",
|
|
1062
|
+
className: h,
|
|
1063
|
+
onMouseDown: (e) => m(e, o),
|
|
1064
|
+
"aria-label": "Ordered list",
|
|
1065
|
+
children: [/* @__PURE__ */ c("span", {
|
|
1066
|
+
className: g,
|
|
1067
|
+
children: /* @__PURE__ */ c("svg", {
|
|
1068
|
+
viewBox: "0 0 20 20",
|
|
1069
|
+
className: "block h-4 w-4",
|
|
1070
|
+
children: [
|
|
1071
|
+
/* @__PURE__ */ c("rect", {
|
|
1072
|
+
x: "7",
|
|
1073
|
+
y: "4",
|
|
1074
|
+
width: "11",
|
|
1075
|
+
height: "2",
|
|
1076
|
+
rx: "1",
|
|
1077
|
+
fill: "black"
|
|
1078
|
+
}),
|
|
1079
|
+
/* @__PURE__ */ c("rect", {
|
|
1080
|
+
x: "7",
|
|
1081
|
+
y: "9",
|
|
1082
|
+
width: "11",
|
|
1083
|
+
height: "2",
|
|
1084
|
+
rx: "1",
|
|
1085
|
+
fill: "black"
|
|
1086
|
+
}),
|
|
1087
|
+
/* @__PURE__ */ c("rect", {
|
|
1088
|
+
x: "7",
|
|
1089
|
+
y: "14",
|
|
1090
|
+
width: "11",
|
|
1091
|
+
height: "2",
|
|
1092
|
+
rx: "1",
|
|
1093
|
+
fill: "black"
|
|
1094
|
+
}),
|
|
1095
|
+
/* @__PURE__ */ c("path", {
|
|
1096
|
+
d: "M 1.5 4.5 L 3.5 3 L 3.5 10 M 2 10 L 5 10",
|
|
1097
|
+
fill: "none",
|
|
1098
|
+
stroke: "black",
|
|
1099
|
+
strokeWidth: "1.6",
|
|
1100
|
+
strokeLinecap: "round",
|
|
1101
|
+
strokeLinejoin: "round"
|
|
1102
|
+
}),
|
|
1103
|
+
/* @__PURE__ */ c("path", {
|
|
1104
|
+
d: "M 1.5 14 C 1.5 12.8 4.5 12.8 4.5 14.5 C 4.5 16 1.5 16.5 1.5 18 L 5 18",
|
|
1105
|
+
fill: "none",
|
|
1106
|
+
stroke: "black",
|
|
1107
|
+
strokeWidth: "1.6",
|
|
1108
|
+
strokeLinecap: "round",
|
|
1109
|
+
strokeLinejoin: "round"
|
|
1110
|
+
})
|
|
1111
|
+
]
|
|
739
1112
|
})
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
children: /* @__PURE__ */ c("svg", {
|
|
756
|
-
viewBox: "0 0 20 20",
|
|
757
|
-
width: "16",
|
|
758
|
-
height: "16",
|
|
1113
|
+
}), /* @__PURE__ */ c("span", {
|
|
1114
|
+
className: _,
|
|
1115
|
+
"data-i18n": "orderedList",
|
|
1116
|
+
children: "Numbered list"
|
|
1117
|
+
})]
|
|
1118
|
+
}),
|
|
1119
|
+
/* @__PURE__ */ c("div", { className: "w-[1px] bg-[#e5e7eb] my-1" }),
|
|
1120
|
+
/* @__PURE__ */ c("button", {
|
|
1121
|
+
type: "button",
|
|
1122
|
+
className: `${h} gap-1 pr-1.5`,
|
|
1123
|
+
onMouseDown: (e) => {
|
|
1124
|
+
e.preventDefault(), typeof t == "function" && t();
|
|
1125
|
+
},
|
|
1126
|
+
onClick: () => f(!d),
|
|
1127
|
+
"aria-label": "Paragraph",
|
|
759
1128
|
children: [
|
|
760
|
-
/* @__PURE__ */ c("
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
1129
|
+
/* @__PURE__ */ c("span", {
|
|
1130
|
+
className: g,
|
|
1131
|
+
children: /* @__PURE__ */ c("svg", {
|
|
1132
|
+
viewBox: "0 0 20 20",
|
|
1133
|
+
className: "block h-4 w-4",
|
|
1134
|
+
children: [
|
|
1135
|
+
/* @__PURE__ */ c("rect", {
|
|
1136
|
+
x: "1",
|
|
1137
|
+
y: "4",
|
|
1138
|
+
width: "18",
|
|
1139
|
+
height: "2",
|
|
1140
|
+
rx: "1",
|
|
1141
|
+
fill: "black"
|
|
1142
|
+
}),
|
|
1143
|
+
/* @__PURE__ */ c("rect", {
|
|
1144
|
+
x: "1",
|
|
1145
|
+
y: "9",
|
|
1146
|
+
width: "18",
|
|
1147
|
+
height: "2",
|
|
1148
|
+
rx: "1",
|
|
1149
|
+
fill: "black"
|
|
1150
|
+
}),
|
|
1151
|
+
/* @__PURE__ */ c("rect", {
|
|
1152
|
+
x: "1",
|
|
1153
|
+
y: "14",
|
|
1154
|
+
width: "12",
|
|
1155
|
+
height: "2",
|
|
1156
|
+
rx: "1",
|
|
1157
|
+
fill: "black"
|
|
1158
|
+
})
|
|
1159
|
+
]
|
|
1160
|
+
})
|
|
766
1161
|
}),
|
|
767
|
-
/* @__PURE__ */ c("
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
height: "2",
|
|
772
|
-
rx: "1"
|
|
1162
|
+
/* @__PURE__ */ c("svg", {
|
|
1163
|
+
className: `h-2.5 w-2.5 fill-current text-gray-700 transition-transform ${d ? "rotate-180" : ""}`,
|
|
1164
|
+
viewBox: "0 0 20 20",
|
|
1165
|
+
children: /* @__PURE__ */ c("path", { d: "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" })
|
|
773
1166
|
}),
|
|
774
|
-
/* @__PURE__ */ c("
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
height: "2",
|
|
779
|
-
rx: "1"
|
|
1167
|
+
/* @__PURE__ */ c("span", {
|
|
1168
|
+
className: _,
|
|
1169
|
+
"data-i18n": "paragraph",
|
|
1170
|
+
children: "Paragraph options"
|
|
780
1171
|
})
|
|
781
1172
|
]
|
|
782
1173
|
})
|
|
783
|
-
|
|
784
|
-
className: "forge-tooltip",
|
|
785
|
-
"data-i18n": "paragraph",
|
|
786
|
-
children: "Paragraph"
|
|
787
|
-
})]
|
|
1174
|
+
]
|
|
788
1175
|
}),
|
|
789
|
-
/* @__PURE__ */ c("div", {
|
|
790
|
-
|
|
791
|
-
className: "forge-toolbar-dropdown forge-dropdown-paragraph",
|
|
1176
|
+
d && /* @__PURE__ */ c("div", {
|
|
1177
|
+
className: "forge-toolbar-dropdown absolute left-0 top-full mt-1 z-20 min-w-[130px] rounded-md border border-[#ccc] bg-white p-1 shadow-lg rtl:left-auto rtl:right-0 block",
|
|
792
1178
|
role: "list",
|
|
793
1179
|
"aria-label": "Paragraph options",
|
|
794
1180
|
children: [/* @__PURE__ */ c("div", {
|
|
795
|
-
className: "forge-toolbar-group forge-toolbar-align",
|
|
1181
|
+
className: "forge-toolbar-group forge-toolbar-align mb-0.5 flex gap-0.5 border-b border-[#eee] pb-1",
|
|
796
1182
|
children: [
|
|
797
1183
|
/* @__PURE__ */ c("button", {
|
|
798
1184
|
type: "button",
|
|
799
|
-
className:
|
|
800
|
-
|
|
1185
|
+
className: v,
|
|
1186
|
+
onMouseDown: (e) => {
|
|
1187
|
+
m(e, s, "left"), f(!1);
|
|
1188
|
+
},
|
|
801
1189
|
"aria-label": "Align left",
|
|
802
1190
|
children: [/* @__PURE__ */ c("span", {
|
|
803
|
-
className:
|
|
1191
|
+
className: g,
|
|
804
1192
|
children: /* @__PURE__ */ c("svg", {
|
|
805
1193
|
viewBox: "0 0 20 20",
|
|
806
|
-
|
|
807
|
-
height: "16",
|
|
1194
|
+
className: "block h-4 w-4",
|
|
808
1195
|
children: [
|
|
809
1196
|
/* @__PURE__ */ c("rect", {
|
|
810
1197
|
x: "1",
|
|
811
|
-
y: "
|
|
1198
|
+
y: "4",
|
|
812
1199
|
width: "18",
|
|
813
1200
|
height: "2",
|
|
814
|
-
rx: "1"
|
|
1201
|
+
rx: "1",
|
|
1202
|
+
fill: "black"
|
|
815
1203
|
}),
|
|
816
1204
|
/* @__PURE__ */ c("rect", {
|
|
817
1205
|
x: "1",
|
|
818
1206
|
y: "9",
|
|
819
1207
|
width: "12",
|
|
820
1208
|
height: "2",
|
|
821
|
-
rx: "1"
|
|
1209
|
+
rx: "1",
|
|
1210
|
+
fill: "black"
|
|
822
1211
|
}),
|
|
823
1212
|
/* @__PURE__ */ c("rect", {
|
|
824
1213
|
x: "1",
|
|
825
|
-
y: "
|
|
1214
|
+
y: "14",
|
|
826
1215
|
width: "18",
|
|
827
1216
|
height: "2",
|
|
828
|
-
rx: "1"
|
|
1217
|
+
rx: "1",
|
|
1218
|
+
fill: "black"
|
|
829
1219
|
})
|
|
830
1220
|
]
|
|
831
1221
|
})
|
|
832
1222
|
}), /* @__PURE__ */ c("span", {
|
|
833
|
-
className:
|
|
1223
|
+
className: _,
|
|
834
1224
|
"data-i18n": "alignLeft",
|
|
835
|
-
children: "
|
|
1225
|
+
children: "Align left"
|
|
836
1226
|
})]
|
|
837
1227
|
}),
|
|
838
1228
|
/* @__PURE__ */ c("button", {
|
|
839
1229
|
type: "button",
|
|
840
|
-
className:
|
|
841
|
-
|
|
1230
|
+
className: v,
|
|
1231
|
+
onMouseDown: (e) => {
|
|
1232
|
+
m(e, s, "center"), f(!1);
|
|
1233
|
+
},
|
|
842
1234
|
"aria-label": "Align center",
|
|
843
1235
|
children: [/* @__PURE__ */ c("span", {
|
|
844
|
-
className:
|
|
1236
|
+
className: g,
|
|
845
1237
|
children: /* @__PURE__ */ c("svg", {
|
|
846
1238
|
viewBox: "0 0 20 20",
|
|
847
|
-
|
|
848
|
-
height: "16",
|
|
1239
|
+
className: "block h-4 w-4",
|
|
849
1240
|
children: [
|
|
850
1241
|
/* @__PURE__ */ c("rect", {
|
|
851
1242
|
x: "1",
|
|
852
|
-
y: "
|
|
1243
|
+
y: "4",
|
|
853
1244
|
width: "18",
|
|
854
1245
|
height: "2",
|
|
855
|
-
rx: "1"
|
|
1246
|
+
rx: "1",
|
|
1247
|
+
fill: "black"
|
|
856
1248
|
}),
|
|
857
1249
|
/* @__PURE__ */ c("rect", {
|
|
858
1250
|
x: "4",
|
|
859
1251
|
y: "9",
|
|
860
1252
|
width: "12",
|
|
861
1253
|
height: "2",
|
|
862
|
-
rx: "1"
|
|
1254
|
+
rx: "1",
|
|
1255
|
+
fill: "black"
|
|
863
1256
|
}),
|
|
864
1257
|
/* @__PURE__ */ c("rect", {
|
|
865
1258
|
x: "1",
|
|
866
|
-
y: "
|
|
1259
|
+
y: "14",
|
|
867
1260
|
width: "18",
|
|
868
1261
|
height: "2",
|
|
869
|
-
rx: "1"
|
|
1262
|
+
rx: "1",
|
|
1263
|
+
fill: "black"
|
|
870
1264
|
})
|
|
871
1265
|
]
|
|
872
1266
|
})
|
|
873
1267
|
}), /* @__PURE__ */ c("span", {
|
|
874
|
-
className:
|
|
1268
|
+
className: _,
|
|
875
1269
|
"data-i18n": "alignCenter",
|
|
876
|
-
children: "
|
|
1270
|
+
children: "Align center"
|
|
877
1271
|
})]
|
|
878
1272
|
}),
|
|
879
1273
|
/* @__PURE__ */ c("button", {
|
|
880
1274
|
type: "button",
|
|
881
|
-
className:
|
|
882
|
-
|
|
1275
|
+
className: v,
|
|
1276
|
+
onMouseDown: (e) => {
|
|
1277
|
+
m(e, s, "right"), f(!1);
|
|
1278
|
+
},
|
|
883
1279
|
"aria-label": "Align right",
|
|
884
1280
|
children: [/* @__PURE__ */ c("span", {
|
|
885
|
-
className:
|
|
1281
|
+
className: g,
|
|
886
1282
|
children: /* @__PURE__ */ c("svg", {
|
|
887
1283
|
viewBox: "0 0 20 20",
|
|
888
|
-
|
|
889
|
-
height: "16",
|
|
1284
|
+
className: "block h-4 w-4",
|
|
890
1285
|
children: [
|
|
891
1286
|
/* @__PURE__ */ c("rect", {
|
|
892
1287
|
x: "1",
|
|
893
|
-
y: "
|
|
1288
|
+
y: "4",
|
|
894
1289
|
width: "18",
|
|
895
1290
|
height: "2",
|
|
896
|
-
rx: "1"
|
|
1291
|
+
rx: "1",
|
|
1292
|
+
fill: "black"
|
|
897
1293
|
}),
|
|
898
1294
|
/* @__PURE__ */ c("rect", {
|
|
899
1295
|
x: "7",
|
|
900
1296
|
y: "9",
|
|
901
1297
|
width: "12",
|
|
902
1298
|
height: "2",
|
|
903
|
-
rx: "1"
|
|
1299
|
+
rx: "1",
|
|
1300
|
+
fill: "black"
|
|
904
1301
|
}),
|
|
905
1302
|
/* @__PURE__ */ c("rect", {
|
|
906
1303
|
x: "1",
|
|
907
|
-
y: "
|
|
1304
|
+
y: "14",
|
|
908
1305
|
width: "18",
|
|
909
1306
|
height: "2",
|
|
910
|
-
rx: "1"
|
|
1307
|
+
rx: "1",
|
|
1308
|
+
fill: "black"
|
|
911
1309
|
})
|
|
912
1310
|
]
|
|
913
1311
|
})
|
|
914
1312
|
}), /* @__PURE__ */ c("span", {
|
|
915
|
-
className:
|
|
1313
|
+
className: _,
|
|
916
1314
|
"data-i18n": "alignRight",
|
|
917
|
-
children: "
|
|
1315
|
+
children: "Align right"
|
|
918
1316
|
})]
|
|
919
1317
|
}),
|
|
920
1318
|
/* @__PURE__ */ c("button", {
|
|
921
1319
|
type: "button",
|
|
922
|
-
className:
|
|
923
|
-
|
|
1320
|
+
className: v,
|
|
1321
|
+
onMouseDown: (e) => {
|
|
1322
|
+
m(e, s, "justify"), f(!1);
|
|
1323
|
+
},
|
|
924
1324
|
"aria-label": "Justify",
|
|
925
1325
|
children: [/* @__PURE__ */ c("span", {
|
|
926
|
-
className:
|
|
1326
|
+
className: g,
|
|
927
1327
|
children: /* @__PURE__ */ c("svg", {
|
|
928
1328
|
viewBox: "0 0 20 20",
|
|
929
|
-
|
|
930
|
-
height: "16",
|
|
1329
|
+
className: "block h-4 w-4",
|
|
931
1330
|
children: [
|
|
932
1331
|
/* @__PURE__ */ c("rect", {
|
|
933
1332
|
x: "1",
|
|
934
|
-
y: "
|
|
1333
|
+
y: "4",
|
|
935
1334
|
width: "18",
|
|
936
1335
|
height: "2",
|
|
937
|
-
rx: "1"
|
|
1336
|
+
rx: "1",
|
|
1337
|
+
fill: "black"
|
|
938
1338
|
}),
|
|
939
1339
|
/* @__PURE__ */ c("rect", {
|
|
940
1340
|
x: "1",
|
|
941
1341
|
y: "9",
|
|
942
1342
|
width: "18",
|
|
943
1343
|
height: "2",
|
|
944
|
-
rx: "1"
|
|
1344
|
+
rx: "1",
|
|
1345
|
+
fill: "black"
|
|
945
1346
|
}),
|
|
946
1347
|
/* @__PURE__ */ c("rect", {
|
|
947
1348
|
x: "1",
|
|
948
|
-
y: "
|
|
1349
|
+
y: "14",
|
|
949
1350
|
width: "18",
|
|
950
1351
|
height: "2",
|
|
951
|
-
rx: "1"
|
|
1352
|
+
rx: "1",
|
|
1353
|
+
fill: "black"
|
|
952
1354
|
})
|
|
953
1355
|
]
|
|
954
1356
|
})
|
|
955
1357
|
}), /* @__PURE__ */ c("span", {
|
|
956
|
-
className:
|
|
1358
|
+
className: _,
|
|
957
1359
|
"data-i18n": "justify",
|
|
958
1360
|
children: "Justify"
|
|
959
1361
|
})]
|
|
960
1362
|
})
|
|
961
1363
|
]
|
|
962
1364
|
}), /* @__PURE__ */ c("div", {
|
|
963
|
-
className: "forge-toolbar-group forge-toolbar-list",
|
|
1365
|
+
className: "forge-toolbar-group forge-toolbar-list flex gap-0.5 py-0.5",
|
|
964
1366
|
children: [/* @__PURE__ */ c("button", {
|
|
965
1367
|
type: "button",
|
|
966
|
-
className:
|
|
967
|
-
|
|
1368
|
+
className: v,
|
|
1369
|
+
onMouseDown: (e) => {
|
|
1370
|
+
m(e, l), f(!1);
|
|
1371
|
+
},
|
|
968
1372
|
"aria-label": "Outdent",
|
|
969
1373
|
children: [/* @__PURE__ */ c("span", {
|
|
970
|
-
className:
|
|
1374
|
+
className: g,
|
|
971
1375
|
children: /* @__PURE__ */ c("svg", {
|
|
972
1376
|
viewBox: "0 0 20 20",
|
|
973
|
-
|
|
974
|
-
height: "16",
|
|
1377
|
+
className: "block h-4 w-4",
|
|
975
1378
|
fill: "none",
|
|
976
|
-
stroke: "
|
|
1379
|
+
stroke: "black",
|
|
977
1380
|
strokeWidth: "2",
|
|
978
1381
|
strokeLinecap: "round",
|
|
979
1382
|
strokeLinejoin: "round",
|
|
980
1383
|
children: [
|
|
981
1384
|
/* @__PURE__ */ c("line", {
|
|
982
1385
|
x1: "9",
|
|
983
|
-
y1: "
|
|
1386
|
+
y1: "4",
|
|
984
1387
|
x2: "19",
|
|
985
|
-
y2: "
|
|
1388
|
+
y2: "4"
|
|
986
1389
|
}),
|
|
987
1390
|
/* @__PURE__ */ c("line", {
|
|
988
1391
|
x1: "9",
|
|
@@ -992,40 +1395,41 @@ function ee({ logic: e }) {
|
|
|
992
1395
|
}),
|
|
993
1396
|
/* @__PURE__ */ c("line", {
|
|
994
1397
|
x1: "9",
|
|
995
|
-
y1: "
|
|
1398
|
+
y1: "16",
|
|
996
1399
|
x2: "19",
|
|
997
|
-
y2: "
|
|
1400
|
+
y2: "16"
|
|
998
1401
|
}),
|
|
999
|
-
/* @__PURE__ */ c("polyline", { points: "6,
|
|
1402
|
+
/* @__PURE__ */ c("polyline", { points: "6,8 2,12 6,16" })
|
|
1000
1403
|
]
|
|
1001
1404
|
})
|
|
1002
1405
|
}), /* @__PURE__ */ c("span", {
|
|
1003
|
-
className:
|
|
1406
|
+
className: _,
|
|
1004
1407
|
"data-i18n": "outdent",
|
|
1005
1408
|
children: "Outdent"
|
|
1006
1409
|
})]
|
|
1007
1410
|
}), /* @__PURE__ */ c("button", {
|
|
1008
1411
|
type: "button",
|
|
1009
|
-
className:
|
|
1010
|
-
|
|
1412
|
+
className: v,
|
|
1413
|
+
onMouseDown: (e) => {
|
|
1414
|
+
m(e, u), f(!1);
|
|
1415
|
+
},
|
|
1011
1416
|
"aria-label": "Indent",
|
|
1012
1417
|
children: [/* @__PURE__ */ c("span", {
|
|
1013
|
-
className:
|
|
1418
|
+
className: g,
|
|
1014
1419
|
children: /* @__PURE__ */ c("svg", {
|
|
1015
1420
|
viewBox: "0 0 20 20",
|
|
1016
|
-
|
|
1017
|
-
height: "16",
|
|
1421
|
+
className: "block h-4 w-4",
|
|
1018
1422
|
fill: "none",
|
|
1019
|
-
stroke: "
|
|
1423
|
+
stroke: "black",
|
|
1020
1424
|
strokeWidth: "2",
|
|
1021
1425
|
strokeLinecap: "round",
|
|
1022
1426
|
strokeLinejoin: "round",
|
|
1023
1427
|
children: [
|
|
1024
1428
|
/* @__PURE__ */ c("line", {
|
|
1025
1429
|
x1: "9",
|
|
1026
|
-
y1: "
|
|
1430
|
+
y1: "4",
|
|
1027
1431
|
x2: "19",
|
|
1028
|
-
y2: "
|
|
1432
|
+
y2: "4"
|
|
1029
1433
|
}),
|
|
1030
1434
|
/* @__PURE__ */ c("line", {
|
|
1031
1435
|
x1: "9",
|
|
@@ -1035,15 +1439,15 @@ function ee({ logic: e }) {
|
|
|
1035
1439
|
}),
|
|
1036
1440
|
/* @__PURE__ */ c("line", {
|
|
1037
1441
|
x1: "9",
|
|
1038
|
-
y1: "
|
|
1442
|
+
y1: "16",
|
|
1039
1443
|
x2: "19",
|
|
1040
|
-
y2: "
|
|
1444
|
+
y2: "16"
|
|
1041
1445
|
}),
|
|
1042
|
-
/* @__PURE__ */ c("polyline", { points: "2,
|
|
1446
|
+
/* @__PURE__ */ c("polyline", { points: "2,8 6,12 2,16" })
|
|
1043
1447
|
]
|
|
1044
1448
|
})
|
|
1045
1449
|
}), /* @__PURE__ */ c("span", {
|
|
1046
|
-
className:
|
|
1450
|
+
className: _,
|
|
1047
1451
|
"data-i18n": "indent",
|
|
1048
1452
|
children: "Indent"
|
|
1049
1453
|
})]
|
|
@@ -1055,72 +1459,237 @@ function ee({ logic: e }) {
|
|
|
1055
1459
|
}
|
|
1056
1460
|
//#endregion
|
|
1057
1461
|
//#region src/components/shared/toolbar/Paragraph/Hooks/paragraphLogic.jsx
|
|
1058
|
-
function
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1462
|
+
function j() {
|
|
1463
|
+
let e = window.getSelection();
|
|
1464
|
+
return e && e.rangeCount > 0 ? e.getRangeAt(0).cloneRange() : null;
|
|
1465
|
+
}
|
|
1466
|
+
function M(e) {
|
|
1467
|
+
if (!e) return;
|
|
1468
|
+
let t = window.getSelection();
|
|
1469
|
+
t && (t.removeAllRanges(), t.addRange(e));
|
|
1470
|
+
}
|
|
1471
|
+
function N(e) {
|
|
1472
|
+
if (!e) return;
|
|
1473
|
+
let t = document.createRange();
|
|
1474
|
+
t.selectNodeContents(e), t.collapse(!1);
|
|
1475
|
+
let n = window.getSelection();
|
|
1476
|
+
n && (n.removeAllRanges(), n.addRange(t));
|
|
1477
|
+
}
|
|
1478
|
+
function P(e) {
|
|
1479
|
+
if (!e || e.nodeType !== 1) return !1;
|
|
1480
|
+
let t = e.tagName.toLowerCase();
|
|
1481
|
+
return [
|
|
1482
|
+
"p",
|
|
1483
|
+
"div",
|
|
1484
|
+
"h1",
|
|
1485
|
+
"h2",
|
|
1486
|
+
"h3",
|
|
1487
|
+
"h4",
|
|
1488
|
+
"h5",
|
|
1489
|
+
"h6",
|
|
1490
|
+
"li",
|
|
1491
|
+
"blockquote",
|
|
1492
|
+
"pre"
|
|
1493
|
+
].includes(t);
|
|
1494
|
+
}
|
|
1495
|
+
function F(e) {
|
|
1496
|
+
if (!e) return null;
|
|
1497
|
+
let t = e.nodeType === 3 ? e.parentNode : e;
|
|
1498
|
+
for (; t && t !== document.body && !P(t);) t = t.parentNode;
|
|
1499
|
+
return t && P(t) ? t : null;
|
|
1500
|
+
}
|
|
1501
|
+
function I(e) {
|
|
1502
|
+
if (!e) return null;
|
|
1503
|
+
let t = e.nodeType === 3 ? e.parentNode : e;
|
|
1504
|
+
for (; t && t !== document.body && t.tagName !== "LI";) t = t.parentNode;
|
|
1505
|
+
return t && t.tagName === "LI" ? t : null;
|
|
1506
|
+
}
|
|
1507
|
+
function L(e) {
|
|
1508
|
+
let t = document.createElement(e);
|
|
1509
|
+
return t.className = e === "ul" ? "list-disc pl-5 my-2" : "list-decimal pl-5 my-2", t;
|
|
1510
|
+
}
|
|
1511
|
+
function R(e, t) {
|
|
1512
|
+
let n = L(t), r = document.createElement("li");
|
|
1513
|
+
return r.innerHTML = e.innerHTML, n.appendChild(r), e.parentNode.replaceChild(n, e), r;
|
|
1514
|
+
}
|
|
1515
|
+
function z(e) {
|
|
1516
|
+
let t = e.parentNode, n = document.createDocumentFragment(), r = Array.from(e.children), i = null;
|
|
1517
|
+
return r.forEach((e) => {
|
|
1518
|
+
let t = document.createElement("div");
|
|
1519
|
+
t.innerHTML = e.innerHTML, n.appendChild(t), i = t;
|
|
1520
|
+
}), t.replaceChild(n, e), i;
|
|
1521
|
+
}
|
|
1522
|
+
function B(e, t) {
|
|
1523
|
+
let n = L(t);
|
|
1524
|
+
return n.innerHTML = e.innerHTML, e.parentNode.replaceChild(n, e), n;
|
|
1525
|
+
}
|
|
1526
|
+
function V() {
|
|
1527
|
+
let e = r(null), t = () => {
|
|
1528
|
+
e.current = j();
|
|
1529
|
+
}, n = (t) => {
|
|
1530
|
+
M(e.current);
|
|
1531
|
+
let n = window.getSelection();
|
|
1532
|
+
if (!n || !n.rangeCount) return;
|
|
1533
|
+
let r = n.anchorNode;
|
|
1534
|
+
if (!r) return;
|
|
1535
|
+
r.nodeType === 3 && (r = r.parentNode);
|
|
1536
|
+
let i = I(r);
|
|
1537
|
+
if (i) {
|
|
1538
|
+
let n = i.parentNode;
|
|
1539
|
+
if (n && (n.tagName === "UL" || n.tagName === "OL")) {
|
|
1540
|
+
if (n.tagName.toLowerCase() === t) {
|
|
1541
|
+
let e = z(n);
|
|
1542
|
+
e && N(e);
|
|
1543
|
+
} else {
|
|
1544
|
+
let e = B(n, t).lastElementChild;
|
|
1545
|
+
e && N(e);
|
|
1546
|
+
}
|
|
1547
|
+
e.current = j();
|
|
1548
|
+
return;
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
let a = F(r);
|
|
1552
|
+
if (a) {
|
|
1553
|
+
if (a.getAttribute && a.getAttribute("contenteditable") === "true") {
|
|
1554
|
+
let e = document.createElement("div");
|
|
1555
|
+
e.innerHTML = a.innerHTML, a.innerHTML = "", a.appendChild(e), N(R(e, t));
|
|
1556
|
+
} else N(R(a, t));
|
|
1557
|
+
e.current = j();
|
|
1558
|
+
}
|
|
1559
|
+
};
|
|
1560
|
+
return {
|
|
1561
|
+
saveSelectionRange: t,
|
|
1562
|
+
toggleUnorderedList: () => n("ul"),
|
|
1563
|
+
toggleOrderedList: () => n("ol"),
|
|
1564
|
+
setAlignment: (t) => {
|
|
1565
|
+
M(e.current);
|
|
1566
|
+
let n = window.getSelection();
|
|
1567
|
+
if (!n || !n.rangeCount) return;
|
|
1568
|
+
let r = n.anchorNode;
|
|
1569
|
+
if (!r) return;
|
|
1570
|
+
r.nodeType === 3 && (r = r.parentNode);
|
|
1571
|
+
let i = r.closest("p, div, h1, h2, h3, h4, h5, h6, li, blockquote, pre");
|
|
1572
|
+
i && (i.style.textAlign = t), e.current = j();
|
|
1573
|
+
},
|
|
1574
|
+
indent: () => {
|
|
1575
|
+
M(e.current);
|
|
1576
|
+
let t = window.getSelection();
|
|
1577
|
+
if (!t || !t.rangeCount) return;
|
|
1578
|
+
let n = t.anchorNode;
|
|
1579
|
+
if (!n) return;
|
|
1580
|
+
n.nodeType === 3 && (n = n.parentNode);
|
|
1581
|
+
let r = I(n);
|
|
1582
|
+
if (r) {
|
|
1583
|
+
let e = r.parentNode;
|
|
1584
|
+
if (!e || e.tagName !== "UL" && e.tagName !== "OL") return;
|
|
1585
|
+
let t = r.previousElementSibling;
|
|
1586
|
+
if (!t || t.tagName !== "LI") return;
|
|
1587
|
+
let n = t.querySelector(":scope > ul, :scope > ol");
|
|
1588
|
+
n || (n = L(e.tagName.toLowerCase()), t.appendChild(n)), n.appendChild(r), N(r);
|
|
1589
|
+
} else {
|
|
1590
|
+
let e = F(n);
|
|
1591
|
+
if (!e) return;
|
|
1592
|
+
let t = parseInt(e.style.marginLeft) || 0;
|
|
1593
|
+
e.style.marginLeft = t + 20 + "px";
|
|
1594
|
+
}
|
|
1595
|
+
e.current = j();
|
|
1596
|
+
},
|
|
1597
|
+
outdent: () => {
|
|
1598
|
+
M(e.current);
|
|
1599
|
+
let t = window.getSelection();
|
|
1600
|
+
if (!t || !t.rangeCount) return;
|
|
1601
|
+
let n = t.anchorNode;
|
|
1602
|
+
if (!n) return;
|
|
1603
|
+
n.nodeType === 3 && (n = n.parentNode);
|
|
1604
|
+
let r = I(n);
|
|
1605
|
+
if (r) {
|
|
1606
|
+
let e = r.parentNode;
|
|
1607
|
+
if (!e || e.tagName !== "UL" && e.tagName !== "OL") return;
|
|
1608
|
+
let t = e.parentNode;
|
|
1609
|
+
if (t && t.tagName === "LI") t.parentNode.insertBefore(r, t.nextSibling), e.children.length === 0 && e.remove(), N(r);
|
|
1610
|
+
else {
|
|
1611
|
+
let t = document.createElement("div");
|
|
1612
|
+
t.innerHTML = r.innerHTML;
|
|
1613
|
+
let n = e.parentNode;
|
|
1614
|
+
e.children.length === 1 ? n.replaceChild(t, e) : (n.insertBefore(t, e.nextSibling), e.removeChild(r)), N(t);
|
|
1615
|
+
}
|
|
1616
|
+
} else {
|
|
1617
|
+
let e = F(n);
|
|
1618
|
+
if (!e) return;
|
|
1619
|
+
let t = parseInt(e.style.marginLeft) || 0;
|
|
1620
|
+
e.style.marginLeft = Math.max(0, t - 20) + "px";
|
|
1621
|
+
}
|
|
1622
|
+
e.current = j();
|
|
1623
|
+
}
|
|
1624
|
+
};
|
|
1062
1625
|
}
|
|
1063
1626
|
//#endregion
|
|
1064
1627
|
//#region src/components/shared/toolbar/Paragraph/Components/index.jsx
|
|
1065
|
-
function
|
|
1066
|
-
return /* @__PURE__ */ c(
|
|
1628
|
+
function H() {
|
|
1629
|
+
return /* @__PURE__ */ c(le, { logic: V() });
|
|
1067
1630
|
}
|
|
1068
1631
|
//#endregion
|
|
1069
1632
|
//#region src/components/shared/toolbar/Table/Components/TableToolbar.jsx
|
|
1070
|
-
var
|
|
1071
|
-
function
|
|
1072
|
-
let { insertTable: t } = e, [a, o] = i(1), [s, l] = i(1), u = r(null),
|
|
1633
|
+
var U = 10;
|
|
1634
|
+
function W({ logic: e }) {
|
|
1635
|
+
let { insertTable: t } = e, [a, o] = i(1), [s, l] = i(1), [u, d] = i(!1), f = r(null), p = r(null), m = r(null);
|
|
1073
1636
|
n(() => {
|
|
1074
|
-
if (u
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1637
|
+
if (!u) return;
|
|
1638
|
+
function e(e) {
|
|
1639
|
+
p.current && !p.current.contains(e.target) && f.current && !f.current.contains(e.target) && d(!1);
|
|
1640
|
+
}
|
|
1641
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
1642
|
+
}, [u]);
|
|
1643
|
+
let h = (e) => {
|
|
1644
|
+
if (!m.current) return;
|
|
1645
|
+
let t = m.current.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top, i = t.width / U, a = Math.min(Math.floor(n / i) + 1, U), s = Math.min(Math.floor(r / i) + 1, U);
|
|
1079
1646
|
l(a), o(s);
|
|
1080
|
-
}, h = () => {
|
|
1081
|
-
o(1), l(1);
|
|
1082
1647
|
}, g = () => {
|
|
1083
|
-
|
|
1084
|
-
}, _ =
|
|
1648
|
+
o(1), l(1);
|
|
1649
|
+
}, _ = () => {
|
|
1650
|
+
t(a, s), d(!1), o(1), l(1);
|
|
1651
|
+
}, v = s / U * 100, y = a / U * 100;
|
|
1085
1652
|
return /* @__PURE__ */ c("div", {
|
|
1086
|
-
className: "forge-toolbar-group forge-toolbar-table",
|
|
1653
|
+
className: "forge-toolbar-group forge-toolbar-table relative flex items-center gap-0.5",
|
|
1087
1654
|
children: [/* @__PURE__ */ c("button", {
|
|
1088
|
-
ref:
|
|
1655
|
+
ref: f,
|
|
1089
1656
|
type: "button",
|
|
1090
|
-
className: "forge-toolbar-button",
|
|
1657
|
+
className: "forge-toolbar-button group relative flex h-8 cursor-pointer items-center justify-center rounded-[2px] border border-[#ccc] bg-white px-2 text-sm leading-none transition-all duration-150 hover:bg-[#f0f0f0] active:translate-y-px",
|
|
1091
1658
|
"aria-label": "Table",
|
|
1659
|
+
onClick: () => d(!u),
|
|
1092
1660
|
children: [/* @__PURE__ */ c("span", {
|
|
1093
1661
|
className: "forge-toolbar-icon",
|
|
1094
1662
|
children: "▦"
|
|
1095
1663
|
}), /* @__PURE__ */ c("span", {
|
|
1096
|
-
className: "
|
|
1664
|
+
className: "pointer-events-none absolute left-1/2 top-[calc(100%+8px)] z-30 -translate-x-1/2 whitespace-nowrap rounded-md border border-[#2c2c2c] bg-[#1e1e1e] px-2.5 py-1 text-[11px] font-medium leading-none text-white opacity-0 shadow-lg transition-all duration-200 group-hover:visible group-hover:opacity-100 rtl:left-1/2 rtl:-translate-x-1/2 before:absolute before:bottom-full before:left-1/2 before:-translate-x-1/2 before:border-x-[5px] before:border-b-[5px] before:border-t-0 before:border-solid before:border-x-transparent before:border-b-[#2c2c2c] after:absolute after:bottom-full after:left-1/2 after:-translate-x-1/2 after:translate-y-[1px] after:border-x-[4px] after:border-b-[4px] after:border-t-0 after:border-solid after:border-x-transparent after:border-b-[#1e1e1e]",
|
|
1097
1665
|
"data-i18n": "table",
|
|
1098
1666
|
children: "Table"
|
|
1099
1667
|
})]
|
|
1100
1668
|
}), /* @__PURE__ */ c("div", {
|
|
1101
|
-
ref:
|
|
1102
|
-
className:
|
|
1669
|
+
ref: p,
|
|
1670
|
+
className: `forge-toolbar-dropdown forge-dropdown-table absolute left-0 top-full z-10 mt-1 min-w-[160px] rounded-[3px] border border-[#ccc] bg-white p-2 shadow-[0_2px_6px_rgba(0,0,0,0.15)] rtl:left-auto rtl:right-0 ${u ? "block" : "hidden"}`,
|
|
1103
1671
|
role: "list",
|
|
1104
1672
|
"aria-label": "Insert table",
|
|
1105
1673
|
children: [/* @__PURE__ */ c("div", {
|
|
1106
|
-
ref:
|
|
1107
|
-
className: "note-dimension-picker",
|
|
1108
|
-
onMouseMove:
|
|
1109
|
-
onMouseLeave:
|
|
1110
|
-
onClick:
|
|
1674
|
+
ref: m,
|
|
1675
|
+
className: "note-dimension-picker relative mx-auto h-40 w-40 cursor-pointer overflow-hidden rounded-[3px] border border-[#ccc] bg-[#f5f5f5]",
|
|
1676
|
+
onMouseMove: h,
|
|
1677
|
+
onMouseLeave: g,
|
|
1678
|
+
onClick: _,
|
|
1111
1679
|
children: [
|
|
1112
|
-
/* @__PURE__ */ c("div", { className: "
|
|
1680
|
+
/* @__PURE__ */ c("div", { className: "absolute inset-0 z-[5]" }),
|
|
1113
1681
|
/* @__PURE__ */ c("div", {
|
|
1114
|
-
className: "
|
|
1682
|
+
className: "pointer-events-none absolute left-0 top-0 z-[3] border-2 border-[#4a90d9] bg-[rgba(74,144,217,0.4)] transition-[width,height] duration-75 ease-in-out",
|
|
1115
1683
|
style: {
|
|
1116
|
-
width:
|
|
1117
|
-
height:
|
|
1684
|
+
width: v + "%",
|
|
1685
|
+
height: y + "%"
|
|
1118
1686
|
}
|
|
1119
1687
|
}),
|
|
1120
|
-
/* @__PURE__ */ c("div", { className: "
|
|
1688
|
+
/* @__PURE__ */ c("div", { className: "pointer-events-none absolute inset-0 z-[2] bg-white/30" }),
|
|
1689
|
+
/* @__PURE__ */ c("div", { className: "pointer-events-none absolute inset-0 z-[1] bg-[linear-gradient(rgba(0,0,0,0.05)_1px,transparent_1px),linear-gradient(90deg,rgba(0,0,0,0.05)_1px,transparent_1px)] bg-[size:16px_16px]" })
|
|
1121
1690
|
]
|
|
1122
1691
|
}), /* @__PURE__ */ c("div", {
|
|
1123
|
-
className: "note-dimension-display",
|
|
1692
|
+
className: "note-dimension-display px-0 pt-1.5 pb-0.5 text-center text-[13px] font-semibold text-[#333]",
|
|
1124
1693
|
children: [
|
|
1125
1694
|
a,
|
|
1126
1695
|
" x ",
|
|
@@ -1132,7 +1701,7 @@ function M({ logic: e }) {
|
|
|
1132
1701
|
}
|
|
1133
1702
|
//#endregion
|
|
1134
1703
|
//#region src/components/shared/toolbar/Table/Hooks/tableLogic.jsx
|
|
1135
|
-
function
|
|
1704
|
+
function G() {
|
|
1136
1705
|
let e = document.querySelector(".forge-editor__content");
|
|
1137
1706
|
if (e) {
|
|
1138
1707
|
e.focus();
|
|
@@ -1143,81 +1712,78 @@ function N() {
|
|
|
1143
1712
|
}
|
|
1144
1713
|
}
|
|
1145
1714
|
}
|
|
1146
|
-
function
|
|
1715
|
+
function K(e) {
|
|
1147
1716
|
let t = window.getSelection();
|
|
1148
1717
|
if (!t || !t.rangeCount) {
|
|
1149
|
-
|
|
1718
|
+
G(), setTimeout(() => K(e), 50);
|
|
1150
1719
|
return;
|
|
1151
1720
|
}
|
|
1152
1721
|
let n = t.getRangeAt(0);
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
} else document.execCommand("insertHTML", !1, e);
|
|
1159
|
-
}
|
|
1160
|
-
function F() {
|
|
1722
|
+
n.deleteContents();
|
|
1723
|
+
let r = n.createContextualFragment(e), i = r.lastChild;
|
|
1724
|
+
n.insertNode(r), i ? (n.setStartAfter(i), n.collapse(!0)) : n.collapse(!1), t.removeAllRanges(), t.addRange(n);
|
|
1725
|
+
}
|
|
1726
|
+
function q() {
|
|
1161
1727
|
return { insertTable: (e, t) => {
|
|
1162
|
-
let n = "<table style=\"width:100%;border-collapse:collapse;border:1px solid #ddd;\">";
|
|
1163
|
-
for (let
|
|
1164
|
-
|
|
1165
|
-
for (let e = 0; e < t; e++)
|
|
1166
|
-
|
|
1728
|
+
let n = (100 / t).toFixed(2) + "%", r = "<table style=\"width:100%;table-layout:fixed;border-collapse:collapse;border:1px solid #ddd;\">";
|
|
1729
|
+
for (let i = 0; i < e; i++) {
|
|
1730
|
+
r += "<tr>";
|
|
1731
|
+
for (let e = 0; e < t; e++) r += `<td style="border:1px solid #ddd;padding:8px;width:${n};text-align:center;vertical-align:middle;overflow:hidden;word-break:break-word;"><br></td>`;
|
|
1732
|
+
r += "</tr>";
|
|
1167
1733
|
}
|
|
1168
|
-
|
|
1734
|
+
r += "</table><br>", G(), K(r);
|
|
1169
1735
|
} };
|
|
1170
1736
|
}
|
|
1171
1737
|
//#endregion
|
|
1172
1738
|
//#region src/components/shared/toolbar/Table/Components/index.jsx
|
|
1173
|
-
function
|
|
1174
|
-
return /* @__PURE__ */ c(
|
|
1739
|
+
function ue() {
|
|
1740
|
+
return /* @__PURE__ */ c(W, { logic: q() });
|
|
1175
1741
|
}
|
|
1176
1742
|
//#endregion
|
|
1177
1743
|
//#region src/components/shared/toolbar/Insert/Components/InsertToolbar.jsx
|
|
1178
|
-
function
|
|
1179
|
-
let { insertLink: t, insertImage: n, insertVideo: r } = e;
|
|
1744
|
+
function de({ logic: e }) {
|
|
1745
|
+
let { insertLink: t, insertImage: n, insertVideo: r } = e, i = "forge-toolbar-button group relative flex h-8 cursor-pointer items-center justify-center gap-0.5 rounded-[2px] border border-[#ccc] bg-white px-[7px] py-1 text-sm leading-none transition-all duration-150 hover:bg-[#f0f0f0] active:translate-y-px", a = "forge-toolbar-icon inline-block min-w-4 text-center text-sm font-medium leading-none", o = "pointer-events-none absolute left-1/2 top-[calc(100%+8px)] z-30 -translate-x-1/2 whitespace-nowrap rounded-md border border-[#2c2c2c] bg-[#1e1e1e] px-2.5 py-1 text-[11px] font-medium leading-none text-white opacity-0 shadow-lg transition-all duration-200 group-hover:visible group-hover:opacity-100 rtl:left-1/2 rtl:-translate-x-1/2 before:absolute before:bottom-full before:left-1/2 before:-translate-x-1/2 before:border-x-[5px] before:border-b-[5px] before:border-t-0 before:border-solid before:border-x-transparent before:border-b-[#2c2c2c] after:absolute after:bottom-full after:left-1/2 after:-translate-x-1/2 after:translate-y-[1px] after:border-x-[4px] after:border-b-[4px] after:border-t-0 after:border-solid after:border-x-transparent after:border-b-[#1e1e1e]";
|
|
1180
1746
|
return /* @__PURE__ */ c("div", {
|
|
1181
|
-
className: "forge-toolbar-group forge-toolbar-insert",
|
|
1747
|
+
className: "forge-toolbar-group forge-toolbar-insert flex items-center gap-0.5",
|
|
1182
1748
|
children: [
|
|
1183
1749
|
/* @__PURE__ */ c("button", {
|
|
1184
1750
|
type: "button",
|
|
1185
|
-
className:
|
|
1751
|
+
className: i,
|
|
1186
1752
|
onClick: t,
|
|
1187
1753
|
"aria-label": "Link",
|
|
1188
1754
|
children: [/* @__PURE__ */ c("span", {
|
|
1189
|
-
className:
|
|
1755
|
+
className: a,
|
|
1190
1756
|
children: "🔗"
|
|
1191
1757
|
}), /* @__PURE__ */ c("span", {
|
|
1192
|
-
className:
|
|
1758
|
+
className: o,
|
|
1193
1759
|
"data-i18n": "link",
|
|
1194
1760
|
children: "Link"
|
|
1195
1761
|
})]
|
|
1196
1762
|
}),
|
|
1197
1763
|
/* @__PURE__ */ c("button", {
|
|
1198
1764
|
type: "button",
|
|
1199
|
-
className:
|
|
1765
|
+
className: i,
|
|
1200
1766
|
onClick: n,
|
|
1201
1767
|
"aria-label": "Image",
|
|
1202
1768
|
children: [/* @__PURE__ */ c("span", {
|
|
1203
|
-
className:
|
|
1769
|
+
className: a,
|
|
1204
1770
|
children: "🖼"
|
|
1205
1771
|
}), /* @__PURE__ */ c("span", {
|
|
1206
|
-
className:
|
|
1772
|
+
className: o,
|
|
1207
1773
|
"data-i18n": "image",
|
|
1208
1774
|
children: "Image"
|
|
1209
1775
|
})]
|
|
1210
1776
|
}),
|
|
1211
1777
|
/* @__PURE__ */ c("button", {
|
|
1212
1778
|
type: "button",
|
|
1213
|
-
className:
|
|
1779
|
+
className: i,
|
|
1214
1780
|
onClick: r,
|
|
1215
1781
|
"aria-label": "Video",
|
|
1216
1782
|
children: [/* @__PURE__ */ c("span", {
|
|
1217
|
-
className:
|
|
1783
|
+
className: a,
|
|
1218
1784
|
children: "▶"
|
|
1219
1785
|
}), /* @__PURE__ */ c("span", {
|
|
1220
|
-
className:
|
|
1786
|
+
className: o,
|
|
1221
1787
|
"data-i18n": "video",
|
|
1222
1788
|
children: "Video"
|
|
1223
1789
|
})]
|
|
@@ -1227,7 +1793,7 @@ function L({ logic: e }) {
|
|
|
1227
1793
|
}
|
|
1228
1794
|
//#endregion
|
|
1229
1795
|
//#region src/components/shared/Hooks/sweetAlert.jsx
|
|
1230
|
-
function
|
|
1796
|
+
function J({ title: e, inputs: t, confirmText: n, cancelText: r }) {
|
|
1231
1797
|
let i = t.map((e, t) => `<input id="${`swal-input-${t}`}" class="swal2-input" placeholder="${e.placeholder || ""}" value="${e.value || ""}">`).join("");
|
|
1232
1798
|
return a.fire({
|
|
1233
1799
|
title: e,
|
|
@@ -1249,16 +1815,16 @@ function R({ title: e, inputs: t, confirmText: n, cancelText: r }) {
|
|
|
1249
1815
|
}
|
|
1250
1816
|
//#endregion
|
|
1251
1817
|
//#region src/components/shared/toolbar/Insert/Hooks/insertLogic.jsx
|
|
1252
|
-
function
|
|
1818
|
+
function Y() {
|
|
1253
1819
|
let e = window.getSelection();
|
|
1254
1820
|
return e && e.rangeCount > 0 ? e.getRangeAt(0).cloneRange() : null;
|
|
1255
1821
|
}
|
|
1256
|
-
function
|
|
1822
|
+
function X(e) {
|
|
1257
1823
|
if (!e) return;
|
|
1258
1824
|
let t = window.getSelection();
|
|
1259
1825
|
t && (t.removeAllRanges(), t.addRange(e));
|
|
1260
1826
|
}
|
|
1261
|
-
function
|
|
1827
|
+
function fe() {
|
|
1262
1828
|
let e = document.querySelector(".forge-editor__content");
|
|
1263
1829
|
if (e) {
|
|
1264
1830
|
e.focus();
|
|
@@ -1269,24 +1835,21 @@ function V() {
|
|
|
1269
1835
|
}
|
|
1270
1836
|
}
|
|
1271
1837
|
}
|
|
1272
|
-
function
|
|
1838
|
+
function Z(e) {
|
|
1273
1839
|
let t = window.getSelection();
|
|
1274
1840
|
if (!t || !t.rangeCount) {
|
|
1275
|
-
|
|
1841
|
+
fe(), setTimeout(() => Z(e), 50);
|
|
1276
1842
|
return;
|
|
1277
1843
|
}
|
|
1278
1844
|
let n = t.getRangeAt(0);
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
} else document.execCommand("insertHTML", !1, e);
|
|
1285
|
-
}
|
|
1286
|
-
function U() {
|
|
1845
|
+
n.deleteContents();
|
|
1846
|
+
let r = n.createContextualFragment(e), i = r.lastChild;
|
|
1847
|
+
n.insertNode(r), i ? (n.setStartAfter(i), n.collapse(!0)) : n.collapse(!1), t.removeAllRanges(), t.addRange(n);
|
|
1848
|
+
}
|
|
1849
|
+
function pe() {
|
|
1287
1850
|
return {
|
|
1288
1851
|
insertLink: async () => {
|
|
1289
|
-
let e =
|
|
1852
|
+
let e = Y(), t = await J({
|
|
1290
1853
|
title: "Insert Link",
|
|
1291
1854
|
inputs: [{
|
|
1292
1855
|
placeholder: "URL",
|
|
@@ -1298,13 +1861,13 @@ function U() {
|
|
|
1298
1861
|
cancelText: "Cancel"
|
|
1299
1862
|
});
|
|
1300
1863
|
if (t.isConfirmed && t.value) {
|
|
1301
|
-
|
|
1864
|
+
X(e);
|
|
1302
1865
|
let [n, r] = t.value;
|
|
1303
|
-
|
|
1866
|
+
Z(r ? `<a href="${n}" target="_blank" rel="noopener">${r}</a>` : `<a href="${n}" target="_blank" rel="noopener">${n}</a>`);
|
|
1304
1867
|
}
|
|
1305
1868
|
},
|
|
1306
1869
|
insertImage: async () => {
|
|
1307
|
-
let e =
|
|
1870
|
+
let e = Y(), t = await J({
|
|
1308
1871
|
title: "Insert Image",
|
|
1309
1872
|
inputs: [{
|
|
1310
1873
|
placeholder: "Image URL",
|
|
@@ -1319,13 +1882,13 @@ function U() {
|
|
|
1319
1882
|
cancelText: "Cancel"
|
|
1320
1883
|
});
|
|
1321
1884
|
if (t.isConfirmed && t.value) {
|
|
1322
|
-
|
|
1885
|
+
X(e);
|
|
1323
1886
|
let [n, r] = t.value;
|
|
1324
|
-
|
|
1887
|
+
Z(`<img src="${n}" alt="${r}" style="max-width: 100%;">`);
|
|
1325
1888
|
}
|
|
1326
1889
|
},
|
|
1327
1890
|
insertVideo: async () => {
|
|
1328
|
-
let e =
|
|
1891
|
+
let e = Y(), t = await J({
|
|
1329
1892
|
title: "Insert Video",
|
|
1330
1893
|
inputs: [{
|
|
1331
1894
|
placeholder: "Video URL (YouTube/Vimeo)",
|
|
@@ -1337,47 +1900,47 @@ function U() {
|
|
|
1337
1900
|
cancelText: "Cancel"
|
|
1338
1901
|
});
|
|
1339
1902
|
if (t.isConfirmed && t.value) {
|
|
1340
|
-
|
|
1903
|
+
X(e);
|
|
1341
1904
|
let [n] = t.value, r;
|
|
1342
|
-
r = n.includes("youtube.com") || n.includes("youtu.be") ? `<iframe width="560" height="315" src="${n.replace("watch?v=", "embed/").replace("youtu.be/", "youtube.com/embed/")}" frameborder="0" allowfullscreen></iframe>` : `<video controls src="${n}" style="max-width: 100%;"></video>`,
|
|
1905
|
+
r = n.includes("youtube.com") || n.includes("youtu.be") ? `<iframe width="560" height="315" src="${n.replace("watch?v=", "embed/").replace("youtu.be/", "youtube.com/embed/")}" frameborder="0" allowfullscreen></iframe>` : `<video controls src="${n}" style="max-width: 100%;"></video>`, Z(r);
|
|
1343
1906
|
}
|
|
1344
1907
|
}
|
|
1345
1908
|
};
|
|
1346
1909
|
}
|
|
1347
1910
|
//#endregion
|
|
1348
1911
|
//#region src/components/shared/toolbar/Insert/Components/index.jsx
|
|
1349
|
-
function
|
|
1350
|
-
return /* @__PURE__ */ c(
|
|
1912
|
+
function me() {
|
|
1913
|
+
return /* @__PURE__ */ c(de, { logic: pe() });
|
|
1351
1914
|
}
|
|
1352
1915
|
//#endregion
|
|
1353
1916
|
//#region src/components/shared/toolbar/View/Components/ViewToolbar.jsx
|
|
1354
|
-
function
|
|
1355
|
-
let { toggleFullscreen: t, toggleCodeView: n, showHelp: r } = e;
|
|
1917
|
+
function he({ logic: e }) {
|
|
1918
|
+
let { toggleFullscreen: t, toggleCodeView: n, showHelp: r } = e, i = "forge-toolbar-button group relative flex h-8 cursor-pointer items-center justify-center rounded-[2px] border border-[#ccc] bg-white px-2 text-sm leading-none transition-all duration-150 hover:bg-[#f0f0f0] active:translate-y-px", a = "pointer-events-none absolute left-1/2 top-[calc(100%+8px)] z-30 -translate-x-1/2 whitespace-nowrap rounded-md border border-[#2c2c2c] bg-[#1e1e1e] px-2.5 py-1 text-[11px] font-medium leading-none text-white opacity-0 shadow-lg transition-all duration-200 group-hover:visible group-hover:opacity-100 rtl:left-1/2 rtl:-translate-x-1/2 before:absolute before:bottom-full before:left-1/2 before:-translate-x-1/2 before:border-x-[5px] before:border-b-[5px] before:border-t-0 before:border-solid before:border-x-transparent before:border-b-[#2c2c2c] after:absolute after:bottom-full after:left-1/2 after:-translate-x-1/2 after:translate-y-[1px] after:border-x-[4px] after:border-b-[4px] after:border-t-0 after:border-solid after:border-x-transparent after:border-b-[#1e1e1e]";
|
|
1356
1919
|
return /* @__PURE__ */ c("div", {
|
|
1357
|
-
className: "forge-toolbar-group forge-toolbar-view",
|
|
1920
|
+
className: "forge-toolbar-group forge-toolbar-view flex items-center gap-0.5",
|
|
1358
1921
|
children: [/* @__PURE__ */ c("button", {
|
|
1359
1922
|
type: "button",
|
|
1360
|
-
className:
|
|
1923
|
+
className: i,
|
|
1361
1924
|
onClick: t,
|
|
1362
1925
|
"aria-label": "Full Screen",
|
|
1363
1926
|
children: [/* @__PURE__ */ c("span", {
|
|
1364
1927
|
className: "forge-toolbar-icon",
|
|
1365
1928
|
children: "⛶"
|
|
1366
1929
|
}), /* @__PURE__ */ c("span", {
|
|
1367
|
-
className:
|
|
1930
|
+
className: a,
|
|
1368
1931
|
"data-i18n": "fullscreen",
|
|
1369
1932
|
children: "Full Screen"
|
|
1370
1933
|
})]
|
|
1371
1934
|
}), /* @__PURE__ */ c("button", {
|
|
1372
1935
|
type: "button",
|
|
1373
|
-
className:
|
|
1936
|
+
className: i,
|
|
1374
1937
|
onClick: n,
|
|
1375
1938
|
"aria-label": "Code View",
|
|
1376
1939
|
children: [/* @__PURE__ */ c("span", {
|
|
1377
1940
|
className: "forge-toolbar-icon",
|
|
1378
1941
|
children: "</>"
|
|
1379
1942
|
}), /* @__PURE__ */ c("span", {
|
|
1380
|
-
className:
|
|
1943
|
+
className: a,
|
|
1381
1944
|
"data-i18n": "codeview",
|
|
1382
1945
|
children: "Code View"
|
|
1383
1946
|
})]
|
|
@@ -1386,7 +1949,7 @@ function G({ logic: e }) {
|
|
|
1386
1949
|
}
|
|
1387
1950
|
//#endregion
|
|
1388
1951
|
//#region src/components/shared/toolbar/View/Hooks/viewLogic.jsx
|
|
1389
|
-
function
|
|
1952
|
+
function ge() {
|
|
1390
1953
|
return {
|
|
1391
1954
|
toggleFullscreen: () => {
|
|
1392
1955
|
let e = document.querySelector(".forge-editor");
|
|
@@ -1414,49 +1977,50 @@ function te() {
|
|
|
1414
1977
|
}
|
|
1415
1978
|
//#endregion
|
|
1416
1979
|
//#region src/components/shared/toolbar/View/Components/index.jsx
|
|
1417
|
-
function
|
|
1418
|
-
return /* @__PURE__ */ c(
|
|
1980
|
+
function _e() {
|
|
1981
|
+
return /* @__PURE__ */ c(he, { logic: ge() });
|
|
1419
1982
|
}
|
|
1420
1983
|
//#endregion
|
|
1421
1984
|
//#region src/components/shared/toolbar/Index/index.jsx
|
|
1422
|
-
function
|
|
1985
|
+
function ve({ editorRef: e }) {
|
|
1423
1986
|
return /* @__PURE__ */ c("div", {
|
|
1424
|
-
className: "forge-editor__toolbar",
|
|
1987
|
+
className: "forge-editor__toolbar sticky top-0 z-10 m-0 flex flex-shrink-0 flex-wrap items-center gap-[4px] rounded-t-[3px] border-b border-[#ddd] bg-[#f5f5f5] p-[5px] text-[#333]",
|
|
1425
1988
|
role: "toolbar",
|
|
1426
1989
|
children: [
|
|
1427
1990
|
/* @__PURE__ */ c(u, {}),
|
|
1428
|
-
/* @__PURE__ */ c(p, {}),
|
|
1429
1991
|
/* @__PURE__ */ c(v, {}),
|
|
1430
|
-
/* @__PURE__ */ c(
|
|
1431
|
-
/* @__PURE__ */ c(
|
|
1432
|
-
/* @__PURE__ */ c(
|
|
1433
|
-
/* @__PURE__ */ c(
|
|
1434
|
-
/* @__PURE__ */ c(
|
|
1992
|
+
/* @__PURE__ */ c(T, { editorRef: e }),
|
|
1993
|
+
/* @__PURE__ */ c(ce, {}),
|
|
1994
|
+
/* @__PURE__ */ c(H, {}),
|
|
1995
|
+
/* @__PURE__ */ c(ue, {}),
|
|
1996
|
+
/* @__PURE__ */ c(me, {}),
|
|
1997
|
+
/* @__PURE__ */ c(_e, {})
|
|
1435
1998
|
]
|
|
1436
1999
|
});
|
|
1437
2000
|
}
|
|
1438
2001
|
//#endregion
|
|
1439
2002
|
//#region src/components/shared/statusbar/Components/index.jsx
|
|
1440
|
-
function
|
|
2003
|
+
function ye() {
|
|
1441
2004
|
return /* @__PURE__ */ c("div", {
|
|
1442
|
-
className: "forge-statusbar",
|
|
2005
|
+
className: "forge-statusbar box-border flex h-2.5 w-full flex-shrink-0 cursor-s-resize items-center justify-center rounded-b-[3px] border-t border-[#ccc] bg-[#f0f0f0]",
|
|
1443
2006
|
role: "status",
|
|
1444
2007
|
children: /* @__PURE__ */ c("div", {
|
|
1445
|
-
className: "
|
|
2008
|
+
className: "flex flex-col items-center gap-px",
|
|
1446
2009
|
"aria-label": "resize",
|
|
1447
2010
|
children: [
|
|
1448
|
-
/* @__PURE__ */ c("div", { className: "
|
|
1449
|
-
/* @__PURE__ */ c("div", { className: "
|
|
1450
|
-
/* @__PURE__ */ c("div", { className: "
|
|
2011
|
+
/* @__PURE__ */ c("div", { className: "h-px w-3 rounded-[1px] bg-[#888]" }),
|
|
2012
|
+
/* @__PURE__ */ c("div", { className: "h-px w-3 rounded-[1px] bg-[#888]" }),
|
|
2013
|
+
/* @__PURE__ */ c("div", { className: "h-px w-3 rounded-[1px] bg-[#888]" })
|
|
1451
2014
|
]
|
|
1452
2015
|
})
|
|
1453
2016
|
});
|
|
1454
2017
|
}
|
|
1455
2018
|
//#endregion
|
|
1456
2019
|
//#region src/components/shared/statusbar/Hooks/resize.js
|
|
1457
|
-
var
|
|
1458
|
-
function
|
|
1459
|
-
|
|
2020
|
+
var be = 100;
|
|
2021
|
+
function xe(e, t, n = {}) {
|
|
2022
|
+
if (!e || !t) return () => {};
|
|
2023
|
+
let r = n.minHeight ?? be, i = n.maxHeight ?? Infinity, a = 0, o = 0;
|
|
1460
2024
|
function s(e) {
|
|
1461
2025
|
let n = e.clientY - a, s = o + n;
|
|
1462
2026
|
s = Math.min(Math.max(s, r), i), t.style.height = `${s}px`;
|
|
@@ -1473,19 +2037,30 @@ function X(e, t, n = {}) {
|
|
|
1473
2037
|
}
|
|
1474
2038
|
//#endregion
|
|
1475
2039
|
//#region src/components/shared/toolbar/Style/Hooks/styleLogic.jsx
|
|
1476
|
-
function
|
|
1477
|
-
let t =
|
|
1478
|
-
if (!t || !
|
|
1479
|
-
|
|
1480
|
-
|
|
2040
|
+
function Se(e) {
|
|
2041
|
+
let t = window.getSelection();
|
|
2042
|
+
if (!t || !t.rangeCount) return;
|
|
2043
|
+
let n = t.getRangeAt(0).commonAncestorContainer;
|
|
2044
|
+
n.nodeType === 3 && (n = n.parentElement);
|
|
2045
|
+
let r = n.closest("p, h1, h2, h3, h4, h5, h6, blockquote, pre");
|
|
2046
|
+
if (r) {
|
|
2047
|
+
let n = document.createElement(e);
|
|
2048
|
+
for (; r.firstChild;) n.appendChild(r.firstChild);
|
|
2049
|
+
r.replaceWith(n);
|
|
2050
|
+
let i = document.createRange();
|
|
2051
|
+
i.selectNodeContents(n), i.collapse(!1), t.removeAllRanges(), t.addRange(i);
|
|
1481
2052
|
}
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
2053
|
+
}
|
|
2054
|
+
function Ce(e) {
|
|
2055
|
+
if (!e) return;
|
|
2056
|
+
let t = e.querySelector("[data-command='style']"), n = e.querySelector(".forge-dropdown-style");
|
|
2057
|
+
!t || !n || (x(t, n), n.querySelectorAll(".forge-dropdown-item").forEach((e) => {
|
|
2058
|
+
e.addEventListener("mousedown", (r) => {
|
|
2059
|
+
r.preventDefault(), r.stopPropagation();
|
|
2060
|
+
let i = e.dataset.value || e.getAttribute("data-value");
|
|
2061
|
+
i && Se(i), n.classList.remove("is-open"), t.classList.remove("is-active");
|
|
1487
2062
|
});
|
|
1488
|
-
});
|
|
2063
|
+
}));
|
|
1489
2064
|
}
|
|
1490
2065
|
//#endregion
|
|
1491
2066
|
//#region src/components/shared/i18n/index.js
|
|
@@ -1563,140 +2138,168 @@ var Q = {
|
|
|
1563
2138
|
help: "مساعدة"
|
|
1564
2139
|
}
|
|
1565
2140
|
}, $ = "en";
|
|
1566
|
-
function
|
|
2141
|
+
function we(e, t) {
|
|
1567
2142
|
return (Q[e] || Q[$])[t] || Q[$][t] || t;
|
|
1568
2143
|
}
|
|
1569
2144
|
//#endregion
|
|
1570
2145
|
//#region src/components/shared/i18n/apply.js
|
|
1571
|
-
function
|
|
2146
|
+
function Te(e, t) {
|
|
1572
2147
|
e.querySelectorAll("[data-i18n]").forEach((e) => {
|
|
1573
|
-
e.textContent =
|
|
2148
|
+
e.textContent = we(t, e.getAttribute("data-i18n"));
|
|
1574
2149
|
});
|
|
1575
2150
|
}
|
|
1576
2151
|
//#endregion
|
|
1577
2152
|
//#region src/components/shared/toolbar/Style/Utils/ensureParagraph.jsx
|
|
1578
|
-
function
|
|
2153
|
+
function Ee(e) {
|
|
1579
2154
|
if (e && !(e.children.length > 0 || e.textContent.trim().length > 0)) {
|
|
1580
2155
|
let t = document.createElement("p");
|
|
1581
2156
|
t.innerHTML = "<br>", e.appendChild(t);
|
|
1582
2157
|
}
|
|
1583
2158
|
}
|
|
1584
2159
|
//#endregion
|
|
2160
|
+
//#region src/components/shared/toolbar/Hooks/contentClick.js
|
|
2161
|
+
function De(e) {
|
|
2162
|
+
e.addEventListener("click", (t) => {
|
|
2163
|
+
if (t.target === e) {
|
|
2164
|
+
let t = window.getSelection();
|
|
2165
|
+
if (!t) return;
|
|
2166
|
+
let n = e.lastElementChild;
|
|
2167
|
+
if (!n || n.tagName === "PRE" || n.tagName === "BLOCKQUOTE" || /^H[1-6]$/.test(n.tagName)) {
|
|
2168
|
+
let n = document.createElement("p");
|
|
2169
|
+
n.innerHTML = "<br>", e.appendChild(n);
|
|
2170
|
+
let r = document.createRange();
|
|
2171
|
+
r.setStart(n, 0), r.collapse(!0), t.removeAllRanges(), t.addRange(r);
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2174
|
+
});
|
|
2175
|
+
}
|
|
2176
|
+
//#endregion
|
|
1585
2177
|
//#region src/components/shared/toolbar/ImagePopover/Components/ImagePopover.jsx
|
|
1586
|
-
function
|
|
2178
|
+
function Oe({ target: e, onClose: t, onResize: n, onFloat: i, onRemove: a }) {
|
|
1587
2179
|
let o = r(null);
|
|
1588
2180
|
if (!e) return null;
|
|
1589
|
-
let s = e.getBoundingClientRect()
|
|
2181
|
+
let s = e.getBoundingClientRect(), l = {
|
|
2182
|
+
left: s.left + s.width / 2 - 100 + "px",
|
|
2183
|
+
top: s.bottom + 10 + "px"
|
|
2184
|
+
}, u = "note-btn cursor-pointer rounded-[2px] border border-[#ccc] bg-[#f5f5f5] px-2 py-1 text-xs leading-[1.4] transition-all duration-100 ease-in-out hover:border-[#999] hover:bg-[#e6e6e6] active:translate-y-px active:bg-[#d0d0d0]", d = "note-btn-group flex gap-0.5 border-r border-[#ddd] pr-1 last:border-r-0 last:pr-0", f = "not-italic text-sm leading-none";
|
|
1590
2185
|
return /* @__PURE__ */ c("div", {
|
|
1591
2186
|
ref: o,
|
|
1592
|
-
className: "note-popover bottom note-image-popover",
|
|
1593
|
-
style:
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
},
|
|
1600
|
-
children: [/* @__PURE__ */ c("div", { className: "note-popover-arrow" }), /* @__PURE__ */ c("div", {
|
|
1601
|
-
className: "popover-content note-children-container",
|
|
2187
|
+
className: "note-popover bottom note-image-popover fixed z-[9999] min-w-[200px] rounded-[4px] border border-[#ccc] bg-white p-1.5 shadow-[0_2px_8px_rgba(0,0,0,0.15)]",
|
|
2188
|
+
style: l,
|
|
2189
|
+
children: [/* @__PURE__ */ c("div", {
|
|
2190
|
+
className: "absolute -top-2 left-1/2 -translate-x-1/2",
|
|
2191
|
+
children: [/* @__PURE__ */ c("div", { className: "border-l-8 border-r-8 border-b-8 border-l-transparent border-r-transparent border-b-[#ccc]" }), /* @__PURE__ */ c("div", { className: "absolute top-[1px] left-[-7px] border-l-7 border-r-7 border-b-7 border-l-transparent border-r-transparent border-b-white" })]
|
|
2192
|
+
}), /* @__PURE__ */ c("div", {
|
|
2193
|
+
className: "popover-content note-children-container flex flex-wrap items-center gap-1",
|
|
1602
2194
|
children: [
|
|
1603
2195
|
/* @__PURE__ */ c("div", {
|
|
1604
|
-
className:
|
|
2196
|
+
className: `${d} note-resize`,
|
|
1605
2197
|
children: [
|
|
1606
2198
|
/* @__PURE__ */ c("button", {
|
|
1607
2199
|
type: "button",
|
|
1608
|
-
className:
|
|
2200
|
+
className: u,
|
|
1609
2201
|
tabIndex: "-1",
|
|
1610
2202
|
"aria-label": "Resize full",
|
|
1611
2203
|
onClick: () => n(e, 1),
|
|
1612
2204
|
children: /* @__PURE__ */ c("span", {
|
|
1613
|
-
className: "note-fontsize-10",
|
|
2205
|
+
className: "note-fontsize-10 text-[10px]",
|
|
1614
2206
|
children: "100%"
|
|
1615
2207
|
})
|
|
1616
2208
|
}),
|
|
1617
2209
|
/* @__PURE__ */ c("button", {
|
|
1618
2210
|
type: "button",
|
|
1619
|
-
className:
|
|
2211
|
+
className: u,
|
|
1620
2212
|
tabIndex: "-1",
|
|
1621
2213
|
"aria-label": "Resize half",
|
|
1622
2214
|
onClick: () => n(e, .5),
|
|
1623
2215
|
children: /* @__PURE__ */ c("span", {
|
|
1624
|
-
className: "note-fontsize-10",
|
|
2216
|
+
className: "note-fontsize-10 text-[10px]",
|
|
1625
2217
|
children: "50%"
|
|
1626
2218
|
})
|
|
1627
2219
|
}),
|
|
1628
2220
|
/* @__PURE__ */ c("button", {
|
|
1629
2221
|
type: "button",
|
|
1630
|
-
className:
|
|
2222
|
+
className: u,
|
|
1631
2223
|
tabIndex: "-1",
|
|
1632
2224
|
"aria-label": "Resize quarter",
|
|
1633
2225
|
onClick: () => n(e, .25),
|
|
1634
2226
|
children: /* @__PURE__ */ c("span", {
|
|
1635
|
-
className: "note-fontsize-10",
|
|
2227
|
+
className: "note-fontsize-10 text-[10px]",
|
|
1636
2228
|
children: "25%"
|
|
1637
2229
|
})
|
|
1638
2230
|
}),
|
|
1639
2231
|
/* @__PURE__ */ c("button", {
|
|
1640
2232
|
type: "button",
|
|
1641
|
-
className:
|
|
2233
|
+
className: u,
|
|
1642
2234
|
tabIndex: "-1",
|
|
1643
2235
|
"aria-label": "Original size",
|
|
1644
2236
|
onClick: () => n(e, "original"),
|
|
1645
2237
|
children: /* @__PURE__ */ c("i", {
|
|
1646
|
-
className:
|
|
2238
|
+
className: `note-icon-rollback ${f}`,
|
|
1647
2239
|
children: "↺"
|
|
1648
2240
|
})
|
|
1649
2241
|
})
|
|
1650
2242
|
]
|
|
1651
2243
|
}),
|
|
1652
2244
|
/* @__PURE__ */ c("div", {
|
|
1653
|
-
className:
|
|
2245
|
+
className: `${d} note-float`,
|
|
1654
2246
|
children: [
|
|
1655
2247
|
/* @__PURE__ */ c("button", {
|
|
1656
2248
|
type: "button",
|
|
1657
|
-
className:
|
|
2249
|
+
className: u,
|
|
1658
2250
|
tabIndex: "-1",
|
|
1659
2251
|
"aria-label": "Float Left",
|
|
1660
2252
|
onClick: () => i(e, "left"),
|
|
1661
2253
|
children: /* @__PURE__ */ c("i", {
|
|
1662
|
-
className:
|
|
2254
|
+
className: `note-icon-float-left ${f}`,
|
|
1663
2255
|
children: "◀"
|
|
1664
2256
|
})
|
|
1665
2257
|
}),
|
|
1666
2258
|
/* @__PURE__ */ c("button", {
|
|
1667
2259
|
type: "button",
|
|
1668
|
-
className:
|
|
2260
|
+
className: u,
|
|
2261
|
+
tabIndex: "-1",
|
|
2262
|
+
"aria-label": "Center",
|
|
2263
|
+
onClick: () => i(e, "center"),
|
|
2264
|
+
children: /* @__PURE__ */ c("i", {
|
|
2265
|
+
className: `note-icon-float-center ${f}`,
|
|
2266
|
+
children: "↔"
|
|
2267
|
+
})
|
|
2268
|
+
}),
|
|
2269
|
+
/* @__PURE__ */ c("button", {
|
|
2270
|
+
type: "button",
|
|
2271
|
+
className: u,
|
|
1669
2272
|
tabIndex: "-1",
|
|
1670
2273
|
"aria-label": "Float Right",
|
|
1671
2274
|
onClick: () => i(e, "right"),
|
|
1672
2275
|
children: /* @__PURE__ */ c("i", {
|
|
1673
|
-
className:
|
|
2276
|
+
className: `note-icon-float-right ${f}`,
|
|
1674
2277
|
children: "▶"
|
|
1675
2278
|
})
|
|
1676
2279
|
}),
|
|
1677
2280
|
/* @__PURE__ */ c("button", {
|
|
1678
2281
|
type: "button",
|
|
1679
|
-
className:
|
|
2282
|
+
className: u,
|
|
1680
2283
|
tabIndex: "-1",
|
|
1681
2284
|
"aria-label": "Remove float",
|
|
1682
2285
|
onClick: () => i(e, "none"),
|
|
1683
2286
|
children: /* @__PURE__ */ c("i", {
|
|
1684
|
-
className:
|
|
2287
|
+
className: `note-icon-rollback ${f}`,
|
|
1685
2288
|
children: "↺"
|
|
1686
2289
|
})
|
|
1687
2290
|
})
|
|
1688
2291
|
]
|
|
1689
2292
|
}),
|
|
1690
2293
|
/* @__PURE__ */ c("div", {
|
|
1691
|
-
className:
|
|
2294
|
+
className: `${d} note-remove`,
|
|
1692
2295
|
children: /* @__PURE__ */ c("button", {
|
|
1693
2296
|
type: "button",
|
|
1694
|
-
className:
|
|
2297
|
+
className: u,
|
|
1695
2298
|
tabIndex: "-1",
|
|
1696
2299
|
"aria-label": "Remove Image",
|
|
1697
2300
|
onClick: () => a(e),
|
|
1698
2301
|
children: /* @__PURE__ */ c("i", {
|
|
1699
|
-
className:
|
|
2302
|
+
className: `note-icon-trash ${f}`,
|
|
1700
2303
|
children: "🗑"
|
|
1701
2304
|
})
|
|
1702
2305
|
})
|
|
@@ -1707,7 +2310,7 @@ function ae({ target: e, onClose: t, onResize: n, onFloat: i, onRemove: a }) {
|
|
|
1707
2310
|
}
|
|
1708
2311
|
//#endregion
|
|
1709
2312
|
//#region src/components/shared/toolbar/ImagePopover/Hooks/useImagePopover.jsx
|
|
1710
|
-
function
|
|
2313
|
+
function ke() {
|
|
1711
2314
|
let [e, t] = i(null), [r, a] = i(!1);
|
|
1712
2315
|
return n(() => {
|
|
1713
2316
|
let e = (e) => {
|
|
@@ -1733,7 +2336,7 @@ function oe() {
|
|
|
1733
2336
|
a(!1), t(null);
|
|
1734
2337
|
},
|
|
1735
2338
|
onFloat: (e, n) => {
|
|
1736
|
-
n === "none" ? (e.style.float = "", e.style.margin = "") : (e.style.float = n, e.style.margin = n === "left" ? "0 10px 5px 0" : "0 0 5px 10px"), a(!1), t(null);
|
|
2339
|
+
n === "none" ? (e.style.float = "", e.style.margin = "", e.style.display = "") : n === "center" ? (e.style.float = "none", e.style.display = "block", e.style.margin = "0 auto") : (e.style.float = n, e.style.display = "", e.style.margin = n === "left" ? "0 10px 5px 0" : "0 0 5px 10px"), a(!1), t(null);
|
|
1737
2340
|
},
|
|
1738
2341
|
onRemove: (e) => {
|
|
1739
2342
|
e.parentElement.removeChild(e), a(!1), t(null);
|
|
@@ -1742,12 +2345,12 @@ function oe() {
|
|
|
1742
2345
|
}
|
|
1743
2346
|
//#endregion
|
|
1744
2347
|
//#region src/components/shared/toolbar/ImagePopover/Components/index.jsx
|
|
1745
|
-
function
|
|
1746
|
-
return /* @__PURE__ */ c(
|
|
2348
|
+
function Ae() {
|
|
2349
|
+
return /* @__PURE__ */ c(Oe, { ...ke() });
|
|
1747
2350
|
}
|
|
1748
2351
|
//#endregion
|
|
1749
2352
|
//#region src/components/light/index.jsx
|
|
1750
|
-
function
|
|
2353
|
+
function je(e) {
|
|
1751
2354
|
return {
|
|
1752
2355
|
getHTML() {
|
|
1753
2356
|
return e.innerHTML;
|
|
@@ -1764,35 +2367,41 @@ function ce(e) {
|
|
|
1764
2367
|
}
|
|
1765
2368
|
};
|
|
1766
2369
|
}
|
|
1767
|
-
function
|
|
1768
|
-
let n = e.lang || "en", r = /* @__PURE__ */ c("div", {
|
|
1769
|
-
className: "forge-editor forge-editor--light",
|
|
2370
|
+
function Me(e) {
|
|
2371
|
+
let n = e.lang || "en", r = e.dir || "ltr", i = { current: null }, a = /* @__PURE__ */ c("div", {
|
|
2372
|
+
className: "forge-editor forge-editor--light flex flex-col w-full rounded-[3px] border border-[#ddd] bg-white box-border align-top min-h-[120px]",
|
|
1770
2373
|
lang: n,
|
|
1771
|
-
dir:
|
|
2374
|
+
dir: r,
|
|
1772
2375
|
children: [
|
|
1773
|
-
/* @__PURE__ */ c(
|
|
2376
|
+
/* @__PURE__ */ c(ve, { editorRef: i }),
|
|
1774
2377
|
/* @__PURE__ */ c("div", {
|
|
1775
|
-
className: "forge-editor__content",
|
|
2378
|
+
className: "forge-editor__content flex-1 min-h-[60px] overflow-auto p-[10px] pb-12 outline-none box-border [&_blockquote]:my-2 [&_blockquote]:border-l-4 [&_blockquote]:border-[#ccc] [&_blockquote]:pl-4 [&_blockquote]:italic [&_pre]:bg-[#f4f4f4] [&_pre]:p-2 [&_pre]:rounded [&_h1]:text-2xl [&_h1]:font-bold [&_h2]:text-xl [&_h2]:font-bold [&_h3]:text-lg [&_h3]:font-bold",
|
|
1776
2379
|
contentEditable: "true",
|
|
1777
2380
|
"data-placeholder": e.placeholder || ""
|
|
1778
2381
|
}),
|
|
1779
|
-
/* @__PURE__ */ c(
|
|
1780
|
-
/* @__PURE__ */ c(
|
|
2382
|
+
/* @__PURE__ */ c(ye, {}),
|
|
2383
|
+
/* @__PURE__ */ c(Ae, {})
|
|
1781
2384
|
]
|
|
1782
|
-
}),
|
|
1783
|
-
t(
|
|
1784
|
-
let
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
2385
|
+
}), o = document.createElement("div");
|
|
2386
|
+
t(a, o);
|
|
2387
|
+
let s = o.firstElementChild, l = s.querySelector(".forge-editor__content");
|
|
2388
|
+
i.current = l, Ee(l), De(l);
|
|
2389
|
+
let u = s.querySelector(".forge-toolbar-style");
|
|
2390
|
+
u && Ce(u);
|
|
2391
|
+
let d = s.querySelector(".forge-editor__toolbar");
|
|
2392
|
+
d && Te(d, n);
|
|
2393
|
+
let f = s.querySelector(".forge-statusbar");
|
|
2394
|
+
return f && xe(f, s, { minHeight: 120 }), {
|
|
2395
|
+
element: s,
|
|
2396
|
+
...je(l)
|
|
1788
2397
|
};
|
|
1789
2398
|
}
|
|
1790
2399
|
//#endregion
|
|
1791
2400
|
//#region src/main/index.jsx
|
|
1792
|
-
function
|
|
2401
|
+
function Ne(e) {
|
|
1793
2402
|
let t = o(e);
|
|
1794
2403
|
if (t.type === "light") {
|
|
1795
|
-
let { element: n, getHTML: r, setHTML: i, getText: a, getSelection: o } =
|
|
2404
|
+
let { element: n, getHTML: r, setHTML: i, getText: a, getSelection: o } = Me(t);
|
|
1796
2405
|
return e.innerHTML = "", e.appendChild(n), n.style.width = t.width, n.style.height = t.height, {
|
|
1797
2406
|
element: n,
|
|
1798
2407
|
getHTML: r,
|
|
@@ -1804,4 +2413,4 @@ function ue(e) {
|
|
|
1804
2413
|
return null;
|
|
1805
2414
|
}
|
|
1806
2415
|
//#endregion
|
|
1807
|
-
export {
|
|
2416
|
+
export { Ne as default };
|