@clevertask/scribe 0.0.9 → 0.0.10
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/README.md +23 -0
- package/dist/BarMenu-SiPgB2ow.js +134 -0
- package/dist/components/Menu/BarMenu.d.ts +1 -0
- package/dist/components/Menu/BarMenu.js +4 -117
- package/dist/components/Scribe/index.d.ts +1 -0
- package/dist/components/Scribe/index.js +66 -73
- package/dist/main.css +37 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -68,6 +68,28 @@ function App() {
|
|
|
68
68
|
}
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
+
### With Dark Mode
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
import "@clevertask/scribe/dist/main.css";
|
|
75
|
+
import { Scribe, ScribeOnChangeContents } from "@clevertask/scribe";
|
|
76
|
+
|
|
77
|
+
function App() {
|
|
78
|
+
const editor = useRef<ScribeRef>(null);
|
|
79
|
+
|
|
80
|
+
const resetContent = useCallback(() => {
|
|
81
|
+
editor.current.resetContent();
|
|
82
|
+
}, []);
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<>
|
|
86
|
+
<Scribe darkMode />
|
|
87
|
+
<button onClick={resetContent}>Reset content</button>
|
|
88
|
+
</>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
71
93
|
## Props
|
|
72
94
|
|
|
73
95
|
| Prop | Type | Default | Description |
|
|
@@ -85,6 +107,7 @@ function App() {
|
|
|
85
107
|
| `mainContainerStyle` | `React.CSSProperties` | `undefined` | You can send a CSS object to style the main editor container |
|
|
86
108
|
| `mainContainerClassName` | `string` | `undefined` | The same idea of `mainContainerStyle` but with classes. |
|
|
87
109
|
| `onKeyDown` | `KeyboardEventHandler` | `undefined` | A callback function that is triggered when a key is pressed within the editor. This allows you to handle custom keyboard shortcuts. For example, you can use this prop to implement a "send message" functionality when `Ctrl + Enter` is pressed. |
|
|
110
|
+
| `darkMode` | `boolean` | `false` | You can switch the darkMode value to change the text editor's theme |
|
|
88
111
|
|
|
89
112
|
## Helper Functions
|
|
90
113
|
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { jsx as o, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback as g, Fragment as h } from "react";
|
|
3
|
+
function r(e) {
|
|
4
|
+
var n, s, c = "";
|
|
5
|
+
if (typeof e == "string" || typeof e == "number") c += e;
|
|
6
|
+
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
7
|
+
var C = e.length;
|
|
8
|
+
for (n = 0; n < C; n++) e[n] && (s = r(e[n])) && (c && (c += " "), c += s);
|
|
9
|
+
} else for (s in e) e[s] && (c && (c += " "), c += s);
|
|
10
|
+
return c;
|
|
11
|
+
}
|
|
12
|
+
function a() {
|
|
13
|
+
for (var e, n, s = 0, c = "", C = arguments.length; s < C; s++) (e = arguments[s]) && (n = r(e)) && (c && (c += " "), c += n);
|
|
14
|
+
return c;
|
|
15
|
+
}
|
|
16
|
+
const v = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%3e%3cscript%20xmlns=''/%3e%3cpath%20d='M15.4062%2019.625H9.625V8.375H14.9375C15.5639%208.37504%2016.1771%208.55435%2016.7048%208.89174C17.2325%209.22914%2017.6526%209.71052%2017.9155%2010.279C18.1784%2010.8475%2018.2731%2011.4794%2018.1884%2012.1C18.1037%2012.7206%2017.8431%2013.304%2017.4375%2013.7812C17.9673%2014.205%2018.3528%2014.7825%2018.5408%2015.4344C18.7289%2016.0862%2018.7102%2016.7803%2018.4875%2017.4211C18.2647%2018.0619%2017.8488%2018.6179%2017.297%2019.0126C16.7452%2019.4073%2016.0847%2019.6213%2015.4062%2019.625ZM11.5%2017.75H15.3937C15.5784%2017.75%2015.7613%2017.7136%2015.9319%2017.643C16.1025%2017.5723%2016.2575%2017.4687%2016.3881%2017.3381C16.5187%2017.2075%2016.6223%2017.0525%2016.693%2016.8819C16.7636%2016.7113%2016.8%2016.5284%2016.8%2016.3438C16.8%2016.1591%2016.7636%2015.9762%2016.693%2015.8056C16.6223%2015.635%2016.5187%2015.48%2016.3881%2015.3494C16.2575%2015.2188%2016.1025%2015.1152%2015.9319%2015.0445C15.7613%2014.9739%2015.5784%2014.9375%2015.3937%2014.9375H11.5V17.75ZM11.5%2013.0625H14.9375C15.1222%2013.0625%2015.305%2013.0261%2015.4756%2012.9555C15.6463%2012.8848%2015.8013%2012.7812%2015.9319%2012.6506C16.0625%2012.52%2016.166%2012.365%2016.2367%2012.1944C16.3074%2012.0238%2016.3438%2011.8409%2016.3438%2011.6562C16.3438%2011.4716%2016.3074%2011.2887%2016.2367%2011.1181C16.166%2010.9475%2016.0625%2010.7925%2015.9319%2010.6619C15.8013%2010.5313%2015.6463%2010.4277%2015.4756%2010.357C15.305%2010.2864%2015.1222%2010.25%2014.9375%2010.25H11.5V13.0625Z'%20fill='%23212529'/%3e%3c/svg%3e", L = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%3e%3cscript%20xmlns=''/%3e%3cpath%20d='M19.625%209.625V8.375H11.5V9.625H14.7125L11.9813%2018.375H8.375V19.625H16.5V18.375H13.2875L16.0187%209.625H19.625Z'%20fill='%23212529'/%3e%3c/svg%3e", w = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%3e%3cscript%20xmlns=''/%3e%3cpath%20d='M21.5%2013.375H15.2225C14.945%2013.3004%2014.6662%2013.2306%2014.3863%2013.1656C12.6312%2012.7506%2011.6388%2012.4469%2011.6388%2011.0263C11.6245%2010.781%2011.6608%2010.5355%2011.7454%2010.3049C11.83%2010.0742%2011.9612%209.86347%2012.1306%209.68564C12.6615%209.24908%2013.3264%209.00852%2014.0137%209.00439C15.7825%208.96064%2016.5981%209.56064%2017.265%2010.4731L18.2744%209.73564C17.8019%209.05711%2017.1578%208.51617%2016.4078%208.16808C15.6578%207.81999%2014.8288%207.67723%2014.0056%207.75439C12.9944%207.76085%2012.0189%208.12911%2011.2556%208.79252C10.9663%209.08595%2010.7402%209.43554%2010.5913%209.81971C10.4423%2010.2039%2010.3736%2010.6145%2010.3894%2011.0263C10.362%2011.4768%2010.4466%2011.9271%2010.6357%2012.337C10.8248%2012.7469%2011.1125%2013.1035%2011.4731%2013.375H6.5V14.625H15.0325C16.2619%2014.9813%2016.9969%2015.445%2017.0156%2016.7238C17.0359%2016.9969%2016.9985%2017.2713%2016.9056%2017.529C16.8128%2017.7867%2016.6667%2018.0219%2016.4769%2018.2194C15.8155%2018.7407%2014.9938%2019.0166%2014.1519%2019C13.5234%2018.9818%2012.9074%2018.8209%2012.3503%2018.5296C11.7932%2018.2382%2011.3097%2017.8239%2010.9362%2017.3181L9.97812%2018.1206C10.4636%2018.7676%2011.0899%2019.2955%2011.8097%2019.6645C12.5295%2020.0334%2013.3238%2020.2336%2014.1325%2020.25H14.195C15.3492%2020.2633%2016.4695%2019.8596%2017.35%2019.1131C17.6625%2018.7981%2017.9054%2018.421%2018.0632%2018.0062C18.2209%2017.5914%2018.2898%2017.1481%2018.2656%2016.705C18.289%2015.947%2018.0332%2015.2069%2017.5469%2014.625H21.5V13.375Z'%20fill='%23212529'/%3e%3c/svg%3e", d = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%3e%3cscript%20xmlns=''/%3e%3cpath%20d='M23.375%2014L19%2018.375L18.1187%2017.4938L21.6063%2014L18.1187%2010.5062L19%209.625L23.375%2014ZM4.625%2014L9%209.625L9.88125%2010.5062L6.39375%2014L9.88125%2017.4938L9%2018.375L4.625%2014Z'%20fill='%23212529'/%3e%3c/svg%3e", f = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%3e%3cscript%20xmlns=''/%3e%3cpath%20d='M22.3988%2014.3575L17.4081%209.36625C17.1736%209.13187%2016.8556%209.00021%2016.5241%209.00021C16.1925%209.00021%2015.8745%209.13187%2015.64%209.36625L12.2912%2012.715L9.625%205.25H8.375L5.25%2014H6.5L7.12438%2012.125H10.8744L11.3763%2013.63L6.86625%2018.14C6.75012%2018.2561%206.658%2018.3939%206.59515%2018.5456C6.5323%2018.6973%206.49995%2018.8599%206.49995%2019.0241C6.49995%2019.1883%206.5323%2019.3508%206.59515%2019.5025C6.658%2019.6542%206.75012%2019.792%206.86625%2019.9081L9.7075%2022.75H15.7013L22.3988%2016.0519C22.5101%2015.9406%2022.5984%2015.8085%2022.6587%2015.6631C22.719%2015.5177%2022.75%2015.3618%2022.75%2015.2044C22.75%2015.047%2022.719%2014.8911%2022.6587%2014.7457C22.5984%2014.6003%2022.5101%2014.4681%2022.3988%2014.3569V14.3575ZM7.54063%2010.875L8.9975%206.5L10.4575%2010.875H7.54063ZM15.1844%2021.5H10.225L7.75%2019.0238L11.695%2015.0794L16.65%2020.0337L15.1844%2021.5ZM17.5344%2019.15L12.5794%2014.1956L16.5244%2010.25L21.4788%2015.2044L17.5344%2019.15Z'%20fill='%23212529'/%3e%3c/svg%3e", u = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%3e%3cscript%20xmlns=''/%3e%3cpath%20d='M8.375%2011.5C9.41053%2011.5%2010.25%2010.6605%2010.25%209.625C10.25%208.58947%209.41053%207.75%208.375%207.75C7.33947%207.75%206.5%208.58947%206.5%209.625C6.5%2010.6605%207.33947%2011.5%208.375%2011.5Z'%20fill='%23212529'/%3e%3cpath%20d='M8.375%2020.25C9.41053%2020.25%2010.25%2019.4105%2010.25%2018.375C10.25%2017.3395%209.41053%2016.5%208.375%2016.5C7.33947%2016.5%206.5%2017.3395%206.5%2018.375C6.5%2019.4105%207.33947%2020.25%208.375%2020.25Z'%20fill='%23212529'/%3e%3cpath%20d='M14%2017.75H22.75V19H14V17.75ZM14%209H22.75V10.25H14V9Z'%20fill='%23212529'/%3e%3c/svg%3e", x = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%3e%3cscript%20xmlns=''/%3e%3cpath%20d='M14%2017.75H22.75V19H14V17.75ZM14%209H22.75V10.25H14V9ZM9%2011.5V6.5H7.75V7.125H6.5V8.375H7.75V11.5H6.5V12.75H10.25V11.5H9ZM10.25%2021.5H6.5V19C6.5%2018.6685%206.6317%2018.3505%206.86612%2018.1161C7.10054%2017.8817%207.41848%2017.75%207.75%2017.75H9V16.5H6.5V15.25H9C9.33152%2015.25%209.64946%2015.3817%209.88388%2015.6161C10.1183%2015.8505%2010.25%2016.1685%2010.25%2016.5V17.75C10.25%2018.0815%2010.1183%2018.3995%209.88388%2018.6339C9.64946%2018.8683%209.33152%2019%209%2019H7.75V20.25H10.25V21.5Z'%20fill='%23212529'/%3e%3c/svg%3e", p = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%3e%3cscript%20xmlns=''/%3e%3cpath%20d='M22.2813%208.225C21.9329%207.8754%2021.5189%207.59801%2021.0631%207.40874C20.6073%207.21947%2020.1186%207.12204%2019.625%207.12204C19.1315%207.12204%2018.6428%207.21947%2018.187%207.40874C17.7312%207.59801%2017.3172%207.8754%2016.9688%208.225L17.8563%209.1125C18.089%208.87981%2018.3652%208.69523%2018.6692%208.56931C18.9733%208.44338%2019.2991%208.37856%2019.6282%208.37856C19.9572%208.37856%2020.2831%208.44338%2020.5871%208.56931C20.8911%208.69523%2021.1674%208.87981%2021.4%209.1125C21.6327%209.34518%2021.8173%209.62142%2021.9432%209.92544C22.0692%2010.2295%2022.134%2010.5553%2022.134%2010.8844C22.134%2011.2134%2022.0692%2011.5393%2021.9432%2011.8433C21.8173%2012.1473%2021.6327%2012.4236%2021.4%2012.6562L16.4%2017.6562C15.9309%2018.1262%2015.2944%2018.3905%2014.6304%2018.3911C13.9664%2018.3917%2013.3293%2018.1285%2012.8594%2017.6594C12.3895%2017.1903%2012.1252%2016.5537%2012.1246%2015.8897C12.124%2015.2257%2012.3872%2014.5887%2012.8563%2014.1187L13.7375%2013.2312L12.8563%2012.3437L11.9688%2013.2312C11.6192%2013.5796%2011.3418%2013.9936%2011.1525%2014.4494C10.9633%2014.9052%2010.8658%2015.3939%2010.8658%2015.8875C10.8658%2016.381%2010.9633%2016.8697%2011.1525%2017.3256C11.3418%2017.7814%2011.6192%2018.1954%2011.9688%2018.5437C12.676%2019.2419%2013.6313%2019.6308%2014.625%2019.625C15.1205%2019.627%2015.6114%2019.5309%2016.0695%2019.3421C16.5276%2019.1533%2016.9437%2018.8756%2017.2938%2018.525L22.2938%2013.525C22.9944%2012.8202%2023.3866%2011.8662%2023.3842%2010.8724C23.3819%209.87866%2022.9852%208.92647%2022.2813%208.225Z'%20fill='%23212529'/%3e%3cpath%20d='M6.61879%2019.5125C6.38541%2019.2802%206.20022%2019.0041%206.07386%2018.7C5.94749%2018.3959%205.88244%2018.0699%205.88244%2017.7406C5.88244%2017.4113%205.94749%2017.0853%206.07386%2016.7812C6.20022%2016.4772%206.38541%2016.201%206.61879%2015.9687L11.6188%2010.9687C11.8511%2010.7354%2012.1272%2010.5502%2012.4313%2010.4238C12.7353%2010.2974%2013.0614%2010.2324%2013.3907%2010.2324C13.7199%2010.2324%2014.046%2010.2974%2014.3501%2010.4238C14.6541%2010.5502%2014.9302%2010.7354%2015.1625%2010.9687C15.3944%2011.2029%2015.577%2011.4812%2015.6994%2011.7871C15.8218%2012.0931%2015.8815%2012.4205%2015.875%2012.75C15.8769%2013.0805%2015.8133%2013.4081%2015.6878%2013.7138C15.5623%2014.0196%2015.3774%2014.2974%2015.1438%2014.5312L13.8188%2015.875L14.7063%2016.7625L16.0313%2015.4375C16.7366%2014.7322%2017.1328%2013.7756%2017.1328%2012.7781C17.1328%2011.7807%2016.7366%2010.8241%2016.0313%2010.1187C15.326%209.41344%2014.3694%209.0172%2013.3719%209.0172C12.3745%209.0172%2011.4179%209.41344%2010.7125%2010.1187L5.71254%2015.1187C5.362%2015.4672%205.08382%2015.8816%204.89399%2016.338C4.70417%2016.7944%204.60645%2017.2838%204.60645%2017.7781C4.60645%2018.2724%204.70417%2018.7618%204.89399%2019.2182C5.08382%2019.6746%205.362%2020.089%205.71254%2020.4375C6.42431%2021.1303%207.38185%2021.5124%208.37504%2021.5C9.37698%2021.501%2010.3386%2021.1055%2011.05%2020.4L10.1625%2019.5125C9.93025%2019.7459%209.65413%2019.9311%209.35006%2020.0574C9.04599%2020.1838%208.71995%2020.2488%208.39067%2020.2488C8.06138%2020.2488%207.73534%2020.1838%207.43127%2020.0574C7.1272%2019.9311%206.85109%2019.7459%206.61879%2019.5125Z'%20fill='%23212529'/%3e%3c/svg%3e", H = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%3e%3cscript%20xmlns=''/%3e%3cpath%20d='M15.875%2012.75C16.2458%2012.75%2016.6084%2012.64%2016.9167%2012.434C17.225%2012.228%2017.4654%2011.9351%2017.6073%2011.5925C17.7492%2011.2499%2017.7863%2010.8729%2017.714%2010.5092C17.6416%2010.1455%2017.463%209.8114%2017.2008%209.54917C16.9386%209.28695%2016.6045%209.10837%2016.2408%209.03603C15.8771%208.96368%2015.5001%209.00081%2015.1575%209.14273C14.8149%209.28464%2014.522%209.52496%2014.316%209.83331C14.11%2010.1416%2014%2010.5042%2014%2010.875C14%2011.3723%2014.1975%2011.8492%2014.5492%2012.2008C14.9008%2012.5525%2015.3777%2012.75%2015.875%2012.75ZM15.875%2010.25C15.9986%2010.25%2016.1195%2010.2867%2016.2222%2010.3553C16.325%2010.424%2016.4051%2010.5216%2016.4524%2010.6358C16.4997%2010.75%2016.5121%2010.8757%2016.488%2010.9969C16.4639%2011.1182%2016.4044%2011.2295%2016.3169%2011.3169C16.2295%2011.4043%2016.1182%2011.4639%2015.9969%2011.488C15.8757%2011.5121%2015.75%2011.4997%2015.6358%2011.4524C15.5216%2011.4051%2015.424%2011.325%2015.3553%2011.2222C15.2867%2011.1195%2015.25%2010.9986%2015.25%2010.875C15.25%2010.7092%2015.3158%2010.5503%2015.4331%2010.4331C15.5503%2010.3158%2015.7092%2010.25%2015.875%2010.25Z'%20fill='%23212529'/%3e%3cpath%20d='M20.25%206.5H7.75C7.41848%206.5%207.10054%206.6317%206.86612%206.86612C6.6317%207.10054%206.5%207.41848%206.5%207.75V20.25C6.5%2020.5815%206.6317%2020.8995%206.86612%2021.1339C7.10054%2021.3683%207.41848%2021.5%207.75%2021.5H20.25C20.5815%2021.5%2020.8995%2021.3683%2021.1339%2021.1339C21.3683%2020.8995%2021.5%2020.5815%2021.5%2020.25V7.75C21.5%207.41848%2021.3683%207.10054%2021.1339%206.86612C20.8995%206.6317%2020.5815%206.5%2020.25%206.5ZM20.25%2020.25H7.75V16.5L10.875%2013.375L14.3688%2016.8687C14.603%2017.1016%2014.9198%2017.2322%2015.25%2017.2322C15.5802%2017.2322%2015.897%2017.1016%2016.1313%2016.8687L17.125%2015.875L20.25%2019V20.25ZM20.25%2017.2312L18.0063%2014.9875C17.772%2014.7547%2017.4552%2014.624%2017.125%2014.624C16.7948%2014.624%2016.478%2014.7547%2016.2437%2014.9875L15.25%2015.9812L11.7562%2012.4875C11.522%2012.2547%2011.2052%2012.124%2010.875%2012.124C10.5448%2012.124%2010.228%2012.2547%209.99375%2012.4875L7.75%2014.7312V7.75H20.25V17.2312Z'%20fill='%23212529'/%3e%3c/svg%3e", V = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%3e%3cscript%20xmlns=''/%3e%3cpath%20d='M23.375%2014L19%2018.375L18.1187%2017.4937L21.6063%2014L18.1187%2010.5062L19%209.625L23.375%2014ZM4.625%2014L9%209.625L9.88125%2010.5062L6.39375%2014L9.88125%2017.4937L9%2018.375L4.625%2014ZM11.7625%2019.9275L15.025%207.75L16.2325%208.07313L12.97%2020.25L11.7625%2019.9275Z'%20fill='%23212529'/%3e%3c/svg%3e", M = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%3e%3cscript%20xmlns=''/%3e%3cpath%20d='M11.5%2013.375H7.81875C7.93491%2012.6015%208.21112%2011.8607%208.62974%2011.1999C9.04837%2010.5391%209.6002%209.97295%2010.25%209.5375L11.3688%208.7875L10.6812%207.75L9.5625%208.5C8.6208%209.12755%207.84857%209.97785%207.31433%2010.9755C6.7801%2011.9731%206.50038%2013.0871%206.5%2014.2188V18.375C6.5%2018.7065%206.6317%2019.0245%206.86612%2019.2589C7.10054%2019.4933%207.41848%2019.625%207.75%2019.625H11.5C11.8315%2019.625%2012.1495%2019.4933%2012.3839%2019.2589C12.6183%2019.0245%2012.75%2018.7065%2012.75%2018.375V14.625C12.75%2014.2935%2012.6183%2013.9755%2012.3839%2013.7411C12.1495%2013.5067%2011.8315%2013.375%2011.5%2013.375ZM20.25%2013.375H16.5688C16.6849%2012.6015%2016.9611%2011.8607%2017.3797%2011.1999C17.7984%2010.5391%2018.3502%209.97295%2019%209.5375L20.1188%208.7875L19.4375%207.75L18.3125%208.5C17.3708%209.12755%2016.5986%209.97785%2016.0643%2010.9755C15.5301%2011.9731%2015.2504%2013.0871%2015.25%2014.2188V18.375C15.25%2018.7065%2015.3817%2019.0245%2015.6161%2019.2589C15.8505%2019.4933%2016.1685%2019.625%2016.5%2019.625H20.25C20.5815%2019.625%2020.8995%2019.4933%2021.1339%2019.2589C21.3683%2019.0245%2021.5%2018.7065%2021.5%2018.375V14.625C21.5%2014.2935%2021.3683%2013.9755%2021.1339%2013.7411C20.8995%2013.5067%2020.5815%2013.375%2020.25%2013.375Z'%20fill='%23212529'/%3e%3c/svg%3e", Z = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%3e%3cscript%20xmlns=''/%3e%3crect%20x='6.5'%20y='13.375'%20width='15'%20height='1.25'%20fill='%23212529'/%3e%3c/svg%3e", k = ({ editor: e, darkMode: n }) => {
|
|
17
|
+
const s = g(() => {
|
|
18
|
+
const l = e.getAttributes("link").href, t = window.prompt("Link", l);
|
|
19
|
+
if (t !== null) {
|
|
20
|
+
if (t === "") {
|
|
21
|
+
e.chain().focus().extendMarkRange("link").unsetLink().run();
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
e.chain().focus().extendMarkRange("link").setLink({ href: t }).selectTextblockEnd().run();
|
|
25
|
+
}
|
|
26
|
+
}, [e]), c = g(() => {
|
|
27
|
+
const l = e.getAttributes("image").src, t = window.prompt(l ? "Update Image URL" : "Image URL", l);
|
|
28
|
+
t && e.chain().focus().setImage({ src: t }).run();
|
|
29
|
+
}, [e]), C = [
|
|
30
|
+
[
|
|
31
|
+
{
|
|
32
|
+
name: "bold",
|
|
33
|
+
icon: v,
|
|
34
|
+
command: () => e.chain().focus().toggleBold().run(),
|
|
35
|
+
isActive: () => e.isActive("bold")
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: "italic",
|
|
39
|
+
icon: L,
|
|
40
|
+
command: () => e.chain().focus().toggleItalic().run(),
|
|
41
|
+
isActive: () => e.isActive("italic")
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "strike",
|
|
45
|
+
icon: w,
|
|
46
|
+
command: () => e.chain().focus().toggleStrike().run(),
|
|
47
|
+
isActive: () => e.isActive("strike")
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
[
|
|
51
|
+
{
|
|
52
|
+
name: "inline-code",
|
|
53
|
+
icon: d,
|
|
54
|
+
command: () => e.chain().focus().toggleCode().run(),
|
|
55
|
+
isActive: () => e.isActive("code")
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "highlight",
|
|
59
|
+
icon: f,
|
|
60
|
+
command: () => e.chain().focus().toggleHighlight().run(),
|
|
61
|
+
isActive: () => e.isActive("highlight")
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
[
|
|
65
|
+
{
|
|
66
|
+
name: "unordered-list",
|
|
67
|
+
icon: u,
|
|
68
|
+
command: () => e.chain().focus().toggleBulletList().run(),
|
|
69
|
+
isActive: () => e.isActive("bulletList")
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "ordered-list",
|
|
73
|
+
icon: x,
|
|
74
|
+
command: () => e.chain().focus().toggleOrderedList().run(),
|
|
75
|
+
isActive: () => e.isActive("orderedList")
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
[
|
|
79
|
+
{
|
|
80
|
+
name: "link",
|
|
81
|
+
icon: p,
|
|
82
|
+
command: () => s(),
|
|
83
|
+
isActive: () => e.isActive("link")
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "image",
|
|
87
|
+
icon: H,
|
|
88
|
+
command: () => c(),
|
|
89
|
+
isActive: () => e.isActive("image"),
|
|
90
|
+
disabled: !1
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: "code-block",
|
|
94
|
+
icon: V,
|
|
95
|
+
command: () => e.chain().focus().toggleCodeBlock().run(),
|
|
96
|
+
isActive: () => e.isActive("codeBlock")
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: "block-quote",
|
|
100
|
+
icon: M,
|
|
101
|
+
command: () => e.chain().focus().toggleBlockquote().run(),
|
|
102
|
+
isActive: () => e.isActive("blockquote")
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "horizontal-line",
|
|
106
|
+
icon: Z,
|
|
107
|
+
command: () => e.chain().focus().setHorizontalRule().run(),
|
|
108
|
+
isActive: () => !1
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
];
|
|
112
|
+
return /* @__PURE__ */ o("div", { className: a("flex flex-row gap-4 border-b p-[8px]", n ? "border-zinc-700" : "border-zinc-200"), children: C.map((l, t) => /* @__PURE__ */ m(h, { children: [
|
|
113
|
+
/* @__PURE__ */ o("div", { className: "flex gap-2", children: l.map((i) => /* @__PURE__ */ o(
|
|
114
|
+
"button",
|
|
115
|
+
{
|
|
116
|
+
title: i.name,
|
|
117
|
+
disabled: i == null ? void 0 : i.disabled,
|
|
118
|
+
className: a(
|
|
119
|
+
"rounded-md",
|
|
120
|
+
i.isActive() ? n ? "bg-zinc-700" : "bg-zinc-200" : "",
|
|
121
|
+
i != null && i.disabled ? "cursor-not-allowed bg-opacity-50" : ""
|
|
122
|
+
),
|
|
123
|
+
onClick: i.command,
|
|
124
|
+
children: /* @__PURE__ */ o("img", { src: i.icon, alt: i.name, style: { filter: `invert(${n ? 1 : 0})` } })
|
|
125
|
+
},
|
|
126
|
+
i.name
|
|
127
|
+
)) }),
|
|
128
|
+
t !== C.length - 1 && /* @__PURE__ */ o("div", { className: a("border-l", n ? "border-zinc-700" : "border-zinc-200") })
|
|
129
|
+
] }, `format-group-${t}`)) });
|
|
130
|
+
};
|
|
131
|
+
export {
|
|
132
|
+
k as B,
|
|
133
|
+
a as c
|
|
134
|
+
};
|
|
@@ -1,119 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
const m = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%3e%3cscript%20xmlns=''/%3e%3cpath%20d='M15.4062%2019.625H9.625V8.375H14.9375C15.5639%208.37504%2016.1771%208.55435%2016.7048%208.89174C17.2325%209.22914%2017.6526%209.71052%2017.9155%2010.279C18.1784%2010.8475%2018.2731%2011.4794%2018.1884%2012.1C18.1037%2012.7206%2017.8431%2013.304%2017.4375%2013.7812C17.9673%2014.205%2018.3528%2014.7825%2018.5408%2015.4344C18.7289%2016.0862%2018.7102%2016.7803%2018.4875%2017.4211C18.2647%2018.0619%2017.8488%2018.6179%2017.297%2019.0126C16.7452%2019.4073%2016.0847%2019.6213%2015.4062%2019.625ZM11.5%2017.75H15.3937C15.5784%2017.75%2015.7613%2017.7136%2015.9319%2017.643C16.1025%2017.5723%2016.2575%2017.4687%2016.3881%2017.3381C16.5187%2017.2075%2016.6223%2017.0525%2016.693%2016.8819C16.7636%2016.7113%2016.8%2016.5284%2016.8%2016.3438C16.8%2016.1591%2016.7636%2015.9762%2016.693%2015.8056C16.6223%2015.635%2016.5187%2015.48%2016.3881%2015.3494C16.2575%2015.2188%2016.1025%2015.1152%2015.9319%2015.0445C15.7613%2014.9739%2015.5784%2014.9375%2015.3937%2014.9375H11.5V17.75ZM11.5%2013.0625H14.9375C15.1222%2013.0625%2015.305%2013.0261%2015.4756%2012.9555C15.6463%2012.8848%2015.8013%2012.7812%2015.9319%2012.6506C16.0625%2012.52%2016.166%2012.365%2016.2367%2012.1944C16.3074%2012.0238%2016.3438%2011.8409%2016.3438%2011.6562C16.3438%2011.4716%2016.3074%2011.2887%2016.2367%2011.1181C16.166%2010.9475%2016.0625%2010.7925%2015.9319%2010.6619C15.8013%2010.5313%2015.6463%2010.4277%2015.4756%2010.357C15.305%2010.2864%2015.1222%2010.25%2014.9375%2010.25H11.5V13.0625Z'%20fill='%23212529'/%3e%3c/svg%3e", h = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%3e%3cscript%20xmlns=''/%3e%3cpath%20d='M19.625%209.625V8.375H11.5V9.625H14.7125L11.9813%2018.375H8.375V19.625H16.5V18.375H13.2875L16.0187%209.625H19.625Z'%20fill='%23212529'/%3e%3c/svg%3e", L = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%3e%3cscript%20xmlns=''/%3e%3cpath%20d='M21.5%2013.375H15.2225C14.945%2013.3004%2014.6662%2013.2306%2014.3863%2013.1656C12.6312%2012.7506%2011.6388%2012.4469%2011.6388%2011.0263C11.6245%2010.781%2011.6608%2010.5355%2011.7454%2010.3049C11.83%2010.0742%2011.9612%209.86347%2012.1306%209.68564C12.6615%209.24908%2013.3264%209.00852%2014.0137%209.00439C15.7825%208.96064%2016.5981%209.56064%2017.265%2010.4731L18.2744%209.73564C17.8019%209.05711%2017.1578%208.51617%2016.4078%208.16808C15.6578%207.81999%2014.8288%207.67723%2014.0056%207.75439C12.9944%207.76085%2012.0189%208.12911%2011.2556%208.79252C10.9663%209.08595%2010.7402%209.43554%2010.5913%209.81971C10.4423%2010.2039%2010.3736%2010.6145%2010.3894%2011.0263C10.362%2011.4768%2010.4466%2011.9271%2010.6357%2012.337C10.8248%2012.7469%2011.1125%2013.1035%2011.4731%2013.375H6.5V14.625H15.0325C16.2619%2014.9813%2016.9969%2015.445%2017.0156%2016.7238C17.0359%2016.9969%2016.9985%2017.2713%2016.9056%2017.529C16.8128%2017.7867%2016.6667%2018.0219%2016.4769%2018.2194C15.8155%2018.7407%2014.9938%2019.0166%2014.1519%2019C13.5234%2018.9818%2012.9074%2018.8209%2012.3503%2018.5296C11.7932%2018.2382%2011.3097%2017.8239%2010.9362%2017.3181L9.97812%2018.1206C10.4636%2018.7676%2011.0899%2019.2955%2011.8097%2019.6645C12.5295%2020.0334%2013.3238%2020.2336%2014.1325%2020.25H14.195C15.3492%2020.2633%2016.4695%2019.8596%2017.35%2019.1131C17.6625%2018.7981%2017.9054%2018.421%2018.0632%2018.0062C18.2209%2017.5914%2018.2898%2017.1481%2018.2656%2016.705C18.289%2015.947%2018.0332%2015.2069%2017.5469%2014.625H21.5V13.375Z'%20fill='%23212529'/%3e%3c/svg%3e", v = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%3e%3cscript%20xmlns=''/%3e%3cpath%20d='M23.375%2014L19%2018.375L18.1187%2017.4938L21.6063%2014L18.1187%2010.5062L19%209.625L23.375%2014ZM4.625%2014L9%209.625L9.88125%2010.5062L6.39375%2014L9.88125%2017.4938L9%2018.375L4.625%2014Z'%20fill='%23212529'/%3e%3c/svg%3e", r = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%3e%3cscript%20xmlns=''/%3e%3cpath%20d='M22.3988%2014.3575L17.4081%209.36625C17.1736%209.13187%2016.8556%209.00021%2016.5241%209.00021C16.1925%209.00021%2015.8745%209.13187%2015.64%209.36625L12.2912%2012.715L9.625%205.25H8.375L5.25%2014H6.5L7.12438%2012.125H10.8744L11.3763%2013.63L6.86625%2018.14C6.75012%2018.2561%206.658%2018.3939%206.59515%2018.5456C6.5323%2018.6973%206.49995%2018.8599%206.49995%2019.0241C6.49995%2019.1883%206.5323%2019.3508%206.59515%2019.5025C6.658%2019.6542%206.75012%2019.792%206.86625%2019.9081L9.7075%2022.75H15.7013L22.3988%2016.0519C22.5101%2015.9406%2022.5984%2015.8085%2022.6587%2015.6631C22.719%2015.5177%2022.75%2015.3618%2022.75%2015.2044C22.75%2015.047%2022.719%2014.8911%2022.6587%2014.7457C22.5984%2014.6003%2022.5101%2014.4681%2022.3988%2014.3569V14.3575ZM7.54063%2010.875L8.9975%206.5L10.4575%2010.875H7.54063ZM15.1844%2021.5H10.225L7.75%2019.0238L11.695%2015.0794L16.65%2020.0337L15.1844%2021.5ZM17.5344%2019.15L12.5794%2014.1956L16.5244%2010.25L21.4788%2015.2044L17.5344%2019.15Z'%20fill='%23212529'/%3e%3c/svg%3e", d = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%3e%3cscript%20xmlns=''/%3e%3cpath%20d='M8.375%2011.5C9.41053%2011.5%2010.25%2010.6605%2010.25%209.625C10.25%208.58947%209.41053%207.75%208.375%207.75C7.33947%207.75%206.5%208.58947%206.5%209.625C6.5%2010.6605%207.33947%2011.5%208.375%2011.5Z'%20fill='%23212529'/%3e%3cpath%20d='M8.375%2020.25C9.41053%2020.25%2010.25%2019.4105%2010.25%2018.375C10.25%2017.3395%209.41053%2016.5%208.375%2016.5C7.33947%2016.5%206.5%2017.3395%206.5%2018.375C6.5%2019.4105%207.33947%2020.25%208.375%2020.25Z'%20fill='%23212529'/%3e%3cpath%20d='M14%2017.75H22.75V19H14V17.75ZM14%209H22.75V10.25H14V9Z'%20fill='%23212529'/%3e%3c/svg%3e", w = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%3e%3cscript%20xmlns=''/%3e%3cpath%20d='M14%2017.75H22.75V19H14V17.75ZM14%209H22.75V10.25H14V9ZM9%2011.5V6.5H7.75V7.125H6.5V8.375H7.75V11.5H6.5V12.75H10.25V11.5H9ZM10.25%2021.5H6.5V19C6.5%2018.6685%206.6317%2018.3505%206.86612%2018.1161C7.10054%2017.8817%207.41848%2017.75%207.75%2017.75H9V16.5H6.5V15.25H9C9.33152%2015.25%209.64946%2015.3817%209.88388%2015.6161C10.1183%2015.8505%2010.25%2016.1685%2010.25%2016.5V17.75C10.25%2018.0815%2010.1183%2018.3995%209.88388%2018.6339C9.64946%2018.8683%209.33152%2019%209%2019H7.75V20.25H10.25V21.5Z'%20fill='%23212529'/%3e%3c/svg%3e", x = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%3e%3cscript%20xmlns=''/%3e%3cpath%20d='M22.2813%208.225C21.9329%207.8754%2021.5189%207.59801%2021.0631%207.40874C20.6073%207.21947%2020.1186%207.12204%2019.625%207.12204C19.1315%207.12204%2018.6428%207.21947%2018.187%207.40874C17.7312%207.59801%2017.3172%207.8754%2016.9688%208.225L17.8563%209.1125C18.089%208.87981%2018.3652%208.69523%2018.6692%208.56931C18.9733%208.44338%2019.2991%208.37856%2019.6282%208.37856C19.9572%208.37856%2020.2831%208.44338%2020.5871%208.56931C20.8911%208.69523%2021.1674%208.87981%2021.4%209.1125C21.6327%209.34518%2021.8173%209.62142%2021.9432%209.92544C22.0692%2010.2295%2022.134%2010.5553%2022.134%2010.8844C22.134%2011.2134%2022.0692%2011.5393%2021.9432%2011.8433C21.8173%2012.1473%2021.6327%2012.4236%2021.4%2012.6562L16.4%2017.6562C15.9309%2018.1262%2015.2944%2018.3905%2014.6304%2018.3911C13.9664%2018.3917%2013.3293%2018.1285%2012.8594%2017.6594C12.3895%2017.1903%2012.1252%2016.5537%2012.1246%2015.8897C12.124%2015.2257%2012.3872%2014.5887%2012.8563%2014.1187L13.7375%2013.2312L12.8563%2012.3437L11.9688%2013.2312C11.6192%2013.5796%2011.3418%2013.9936%2011.1525%2014.4494C10.9633%2014.9052%2010.8658%2015.3939%2010.8658%2015.8875C10.8658%2016.381%2010.9633%2016.8697%2011.1525%2017.3256C11.3418%2017.7814%2011.6192%2018.1954%2011.9688%2018.5437C12.676%2019.2419%2013.6313%2019.6308%2014.625%2019.625C15.1205%2019.627%2015.6114%2019.5309%2016.0695%2019.3421C16.5276%2019.1533%2016.9437%2018.8756%2017.2938%2018.525L22.2938%2013.525C22.9944%2012.8202%2023.3866%2011.8662%2023.3842%2010.8724C23.3819%209.87866%2022.9852%208.92647%2022.2813%208.225Z'%20fill='%23212529'/%3e%3cpath%20d='M6.61879%2019.5125C6.38541%2019.2802%206.20022%2019.0041%206.07386%2018.7C5.94749%2018.3959%205.88244%2018.0699%205.88244%2017.7406C5.88244%2017.4113%205.94749%2017.0853%206.07386%2016.7812C6.20022%2016.4772%206.38541%2016.201%206.61879%2015.9687L11.6188%2010.9687C11.8511%2010.7354%2012.1272%2010.5502%2012.4313%2010.4238C12.7353%2010.2974%2013.0614%2010.2324%2013.3907%2010.2324C13.7199%2010.2324%2014.046%2010.2974%2014.3501%2010.4238C14.6541%2010.5502%2014.9302%2010.7354%2015.1625%2010.9687C15.3944%2011.2029%2015.577%2011.4812%2015.6994%2011.7871C15.8218%2012.0931%2015.8815%2012.4205%2015.875%2012.75C15.8769%2013.0805%2015.8133%2013.4081%2015.6878%2013.7138C15.5623%2014.0196%2015.3774%2014.2974%2015.1438%2014.5312L13.8188%2015.875L14.7063%2016.7625L16.0313%2015.4375C16.7366%2014.7322%2017.1328%2013.7756%2017.1328%2012.7781C17.1328%2011.7807%2016.7366%2010.8241%2016.0313%2010.1187C15.326%209.41344%2014.3694%209.0172%2013.3719%209.0172C12.3745%209.0172%2011.4179%209.41344%2010.7125%2010.1187L5.71254%2015.1187C5.362%2015.4672%205.08382%2015.8816%204.89399%2016.338C4.70417%2016.7944%204.60645%2017.2838%204.60645%2017.7781C4.60645%2018.2724%204.70417%2018.7618%204.89399%2019.2182C5.08382%2019.6746%205.362%2020.089%205.71254%2020.4375C6.42431%2021.1303%207.38185%2021.5124%208.37504%2021.5C9.37698%2021.501%2010.3386%2021.1055%2011.05%2020.4L10.1625%2019.5125C9.93025%2019.7459%209.65413%2019.9311%209.35006%2020.0574C9.04599%2020.1838%208.71995%2020.2488%208.39067%2020.2488C8.06138%2020.2488%207.73534%2020.1838%207.43127%2020.0574C7.1272%2019.9311%206.85109%2019.7459%206.61879%2019.5125Z'%20fill='%23212529'/%3e%3c/svg%3e", p = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%3e%3cscript%20xmlns=''/%3e%3cpath%20d='M15.875%2012.75C16.2458%2012.75%2016.6084%2012.64%2016.9167%2012.434C17.225%2012.228%2017.4654%2011.9351%2017.6073%2011.5925C17.7492%2011.2499%2017.7863%2010.8729%2017.714%2010.5092C17.6416%2010.1455%2017.463%209.8114%2017.2008%209.54917C16.9386%209.28695%2016.6045%209.10837%2016.2408%209.03603C15.8771%208.96368%2015.5001%209.00081%2015.1575%209.14273C14.8149%209.28464%2014.522%209.52496%2014.316%209.83331C14.11%2010.1416%2014%2010.5042%2014%2010.875C14%2011.3723%2014.1975%2011.8492%2014.5492%2012.2008C14.9008%2012.5525%2015.3777%2012.75%2015.875%2012.75ZM15.875%2010.25C15.9986%2010.25%2016.1195%2010.2867%2016.2222%2010.3553C16.325%2010.424%2016.4051%2010.5216%2016.4524%2010.6358C16.4997%2010.75%2016.5121%2010.8757%2016.488%2010.9969C16.4639%2011.1182%2016.4044%2011.2295%2016.3169%2011.3169C16.2295%2011.4043%2016.1182%2011.4639%2015.9969%2011.488C15.8757%2011.5121%2015.75%2011.4997%2015.6358%2011.4524C15.5216%2011.4051%2015.424%2011.325%2015.3553%2011.2222C15.2867%2011.1195%2015.25%2010.9986%2015.25%2010.875C15.25%2010.7092%2015.3158%2010.5503%2015.4331%2010.4331C15.5503%2010.3158%2015.7092%2010.25%2015.875%2010.25Z'%20fill='%23212529'/%3e%3cpath%20d='M20.25%206.5H7.75C7.41848%206.5%207.10054%206.6317%206.86612%206.86612C6.6317%207.10054%206.5%207.41848%206.5%207.75V20.25C6.5%2020.5815%206.6317%2020.8995%206.86612%2021.1339C7.10054%2021.3683%207.41848%2021.5%207.75%2021.5H20.25C20.5815%2021.5%2020.8995%2021.3683%2021.1339%2021.1339C21.3683%2020.8995%2021.5%2020.5815%2021.5%2020.25V7.75C21.5%207.41848%2021.3683%207.10054%2021.1339%206.86612C20.8995%206.6317%2020.5815%206.5%2020.25%206.5ZM20.25%2020.25H7.75V16.5L10.875%2013.375L14.3688%2016.8687C14.603%2017.1016%2014.9198%2017.2322%2015.25%2017.2322C15.5802%2017.2322%2015.897%2017.1016%2016.1313%2016.8687L17.125%2015.875L20.25%2019V20.25ZM20.25%2017.2312L18.0063%2014.9875C17.772%2014.7547%2017.4552%2014.624%2017.125%2014.624C16.7948%2014.624%2016.478%2014.7547%2016.2437%2014.9875L15.25%2015.9812L11.7562%2012.4875C11.522%2012.2547%2011.2052%2012.124%2010.875%2012.124C10.5448%2012.124%2010.228%2012.2547%209.99375%2012.4875L7.75%2014.7312V7.75H20.25V17.2312Z'%20fill='%23212529'/%3e%3c/svg%3e", f = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%3e%3cscript%20xmlns=''/%3e%3cpath%20d='M23.375%2014L19%2018.375L18.1187%2017.4937L21.6063%2014L18.1187%2010.5062L19%209.625L23.375%2014ZM4.625%2014L9%209.625L9.88125%2010.5062L6.39375%2014L9.88125%2017.4937L9%2018.375L4.625%2014ZM11.7625%2019.9275L15.025%207.75L16.2325%208.07313L12.97%2020.25L11.7625%2019.9275Z'%20fill='%23212529'/%3e%3c/svg%3e", H = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%3e%3cscript%20xmlns=''/%3e%3cpath%20d='M11.5%2013.375H7.81875C7.93491%2012.6015%208.21112%2011.8607%208.62974%2011.1999C9.04837%2010.5391%209.6002%209.97295%2010.25%209.5375L11.3688%208.7875L10.6812%207.75L9.5625%208.5C8.6208%209.12755%207.84857%209.97785%207.31433%2010.9755C6.7801%2011.9731%206.50038%2013.0871%206.5%2014.2188V18.375C6.5%2018.7065%206.6317%2019.0245%206.86612%2019.2589C7.10054%2019.4933%207.41848%2019.625%207.75%2019.625H11.5C11.8315%2019.625%2012.1495%2019.4933%2012.3839%2019.2589C12.6183%2019.0245%2012.75%2018.7065%2012.75%2018.375V14.625C12.75%2014.2935%2012.6183%2013.9755%2012.3839%2013.7411C12.1495%2013.5067%2011.8315%2013.375%2011.5%2013.375ZM20.25%2013.375H16.5688C16.6849%2012.6015%2016.9611%2011.8607%2017.3797%2011.1999C17.7984%2010.5391%2018.3502%209.97295%2019%209.5375L20.1188%208.7875L19.4375%207.75L18.3125%208.5C17.3708%209.12755%2016.5986%209.97785%2016.0643%2010.9755C15.5301%2011.9731%2015.2504%2013.0871%2015.25%2014.2188V18.375C15.25%2018.7065%2015.3817%2019.0245%2015.6161%2019.2589C15.8505%2019.4933%2016.1685%2019.625%2016.5%2019.625H20.25C20.5815%2019.625%2020.8995%2019.4933%2021.1339%2019.2589C21.3683%2019.0245%2021.5%2018.7065%2021.5%2018.375V14.625C21.5%2014.2935%2021.3683%2013.9755%2021.1339%2013.7411C20.8995%2013.5067%2020.5815%2013.375%2020.25%2013.375Z'%20fill='%23212529'/%3e%3c/svg%3e", u = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%3e%3cscript%20xmlns=''/%3e%3crect%20x='6.5'%20y='13.375'%20width='15'%20height='1.25'%20fill='%23212529'/%3e%3c/svg%3e", Z = ({ editor: e }) => {
|
|
4
|
-
const t = l(() => {
|
|
5
|
-
const i = e.getAttributes("link").href, n = window.prompt("Link", i);
|
|
6
|
-
if (n !== null) {
|
|
7
|
-
if (n === "") {
|
|
8
|
-
e.chain().focus().extendMarkRange("link").unsetLink().run();
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
e.chain().focus().extendMarkRange("link").setLink({ href: n }).selectTextblockEnd().run();
|
|
12
|
-
}
|
|
13
|
-
}, [e]), o = l(() => {
|
|
14
|
-
const i = e.getAttributes("image").src, n = window.prompt(
|
|
15
|
-
i ? "Update Image URL" : "Image URL",
|
|
16
|
-
i
|
|
17
|
-
);
|
|
18
|
-
n && e.chain().focus().setImage({ src: n }).run();
|
|
19
|
-
}, [e]), C = [
|
|
20
|
-
[
|
|
21
|
-
{
|
|
22
|
-
name: "bold",
|
|
23
|
-
icon: m,
|
|
24
|
-
command: () => e.chain().focus().toggleBold().run(),
|
|
25
|
-
isActive: () => e.isActive("bold")
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
name: "italic",
|
|
29
|
-
icon: h,
|
|
30
|
-
command: () => e.chain().focus().toggleItalic().run(),
|
|
31
|
-
isActive: () => e.isActive("italic")
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: "strike",
|
|
35
|
-
icon: L,
|
|
36
|
-
command: () => e.chain().focus().toggleStrike().run(),
|
|
37
|
-
isActive: () => e.isActive("strike")
|
|
38
|
-
}
|
|
39
|
-
],
|
|
40
|
-
[
|
|
41
|
-
{
|
|
42
|
-
name: "inline-code",
|
|
43
|
-
icon: v,
|
|
44
|
-
command: () => e.chain().focus().toggleCode().run(),
|
|
45
|
-
isActive: () => e.isActive("code")
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
name: "highlight",
|
|
49
|
-
icon: r,
|
|
50
|
-
command: () => e.chain().focus().toggleHighlight().run(),
|
|
51
|
-
isActive: () => e.isActive("highlight")
|
|
52
|
-
}
|
|
53
|
-
],
|
|
54
|
-
[
|
|
55
|
-
{
|
|
56
|
-
name: "unordered-list",
|
|
57
|
-
icon: d,
|
|
58
|
-
command: () => e.chain().focus().toggleBulletList().run(),
|
|
59
|
-
isActive: () => e.isActive("bulletList")
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
name: "ordered-list",
|
|
63
|
-
icon: w,
|
|
64
|
-
command: () => e.chain().focus().toggleOrderedList().run(),
|
|
65
|
-
isActive: () => e.isActive("orderedList")
|
|
66
|
-
}
|
|
67
|
-
],
|
|
68
|
-
[
|
|
69
|
-
{
|
|
70
|
-
name: "link",
|
|
71
|
-
icon: x,
|
|
72
|
-
command: () => t(),
|
|
73
|
-
isActive: () => e.isActive("link")
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
name: "image",
|
|
77
|
-
icon: p,
|
|
78
|
-
command: () => o(),
|
|
79
|
-
isActive: () => e.isActive("image"),
|
|
80
|
-
disabled: !1
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
name: "code-block",
|
|
84
|
-
icon: f,
|
|
85
|
-
command: () => e.chain().focus().toggleCodeBlock().run(),
|
|
86
|
-
isActive: () => e.isActive("codeBlock")
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
name: "block-quote",
|
|
90
|
-
icon: H,
|
|
91
|
-
command: () => e.chain().focus().toggleBlockquote().run(),
|
|
92
|
-
isActive: () => e.isActive("blockquote")
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
name: "horizontal-line",
|
|
96
|
-
icon: u,
|
|
97
|
-
command: () => e.chain().focus().setHorizontalRule().run(),
|
|
98
|
-
isActive: () => !1
|
|
99
|
-
}
|
|
100
|
-
]
|
|
101
|
-
];
|
|
102
|
-
return /* @__PURE__ */ s("div", { className: "flex flex-row gap-4 border-b p-[8px]", children: C.map((i, n) => /* @__PURE__ */ a(g, { children: [
|
|
103
|
-
/* @__PURE__ */ s("div", { className: "flex gap-2", children: i.map((c) => /* @__PURE__ */ s(
|
|
104
|
-
"button",
|
|
105
|
-
{
|
|
106
|
-
title: c.name,
|
|
107
|
-
disabled: c == null ? void 0 : c.disabled,
|
|
108
|
-
className: `rounded-md ${c.isActive() ? "bg-gray-100" : ""} ${c != null && c.disabled ? "cursor-not-allowed bg-opacity-50" : ""}`,
|
|
109
|
-
onClick: c.command,
|
|
110
|
-
children: /* @__PURE__ */ s("img", { src: c.icon, alt: c.name })
|
|
111
|
-
},
|
|
112
|
-
c.name
|
|
113
|
-
)) }),
|
|
114
|
-
n !== C.length - 1 && /* @__PURE__ */ s("div", { className: "border-l" })
|
|
115
|
-
] }, `format-group-${n}`)) });
|
|
116
|
-
};
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import { B as p } from "../../BarMenu-SiPgB2ow.js";
|
|
3
|
+
import "react";
|
|
117
4
|
export {
|
|
118
|
-
|
|
5
|
+
p as default
|
|
119
6
|
};
|
|
@@ -28,5 +28,6 @@ export interface ScribeProps {
|
|
|
28
28
|
mainContainerStyle?: React.CSSProperties;
|
|
29
29
|
mainContainerClassName?: ClassValue;
|
|
30
30
|
onKeyDown?: KeyboardEventHandler;
|
|
31
|
+
darkMode?: boolean;
|
|
31
32
|
}
|
|
32
33
|
export declare const Scribe: import('react').ForwardRefExoticComponent<ScribeProps & import('react').RefAttributes<ScribeRef>>;
|
|
@@ -1,96 +1,89 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import R from "
|
|
3
|
-
import { html2md as
|
|
1
|
+
import { jsx as a, jsxs as L } from "react/jsx-runtime";
|
|
2
|
+
import { c as p, B as R } from "../../BarMenu-SiPgB2ow.js";
|
|
3
|
+
import { html2md as g } from "../../utils/html-to-markdown.js";
|
|
4
4
|
import "../../browser-DEobZXxB.js";
|
|
5
5
|
import { E as T } from "../../index-Gm-3o3nq.js";
|
|
6
|
-
import { initExtensions as
|
|
6
|
+
import { initExtensions as z } from "./extension/index.js";
|
|
7
7
|
import { E as J } from "../../index-C3_lI_rP.js";
|
|
8
|
-
import { forwardRef as O, useRef as P, useCallback as
|
|
9
|
-
import '../../assets/index.css';
|
|
10
|
-
var r, s, e = "";
|
|
11
|
-
if (typeof n == "string" || typeof n == "number") e += n;
|
|
12
|
-
else if (typeof n == "object") if (Array.isArray(n)) {
|
|
13
|
-
var o = n.length;
|
|
14
|
-
for (r = 0; r < o; r++) n[r] && (s = h(n[r])) && (e && (e += " "), e += s);
|
|
15
|
-
} else for (s in n) n[s] && (e && (e += " "), e += s);
|
|
16
|
-
return e;
|
|
17
|
-
}
|
|
18
|
-
function y() {
|
|
19
|
-
for (var n, r, s = 0, e = "", o = arguments.length; s < o; s++) (n = arguments[s]) && (r = h(n)) && (e && (e += " "), e += r);
|
|
20
|
-
return e;
|
|
21
|
-
}
|
|
22
|
-
const V = O((n, r) => {
|
|
8
|
+
import { forwardRef as O, useRef as P, useCallback as m, useImperativeHandle as D, useEffect as c } from "react";
|
|
9
|
+
import '../../assets/index.css';const V = O((C, x) => {
|
|
23
10
|
const {
|
|
24
|
-
autoFocus:
|
|
25
|
-
content:
|
|
26
|
-
editable:
|
|
27
|
-
editorProps:
|
|
28
|
-
extensions:
|
|
29
|
-
onContentChange:
|
|
11
|
+
autoFocus: d = !1,
|
|
12
|
+
content: E,
|
|
13
|
+
editable: e = !0,
|
|
14
|
+
editorProps: o,
|
|
15
|
+
extensions: h,
|
|
16
|
+
onContentChange: l,
|
|
30
17
|
showBarMenu: w = !0,
|
|
31
|
-
editorContentStyle:
|
|
32
|
-
editorContentClassName:
|
|
18
|
+
editorContentStyle: y,
|
|
19
|
+
editorContentClassName: M,
|
|
33
20
|
mainContainerStyle: N,
|
|
34
21
|
mainContainerClassName: j,
|
|
35
|
-
onKeyDown:
|
|
36
|
-
externalEditor:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
22
|
+
onKeyDown: k,
|
|
23
|
+
externalEditor: v,
|
|
24
|
+
darkMode: i
|
|
25
|
+
} = C, u = P(v || null), f = m(
|
|
26
|
+
({ editor: t }) => {
|
|
27
|
+
const s = t.getHTML(), r = t.getJSON(), H = !e;
|
|
28
|
+
l && l({
|
|
29
|
+
jsonContent: t.isEmpty ? "" : r,
|
|
30
|
+
htmlContent: t.isEmpty ? "" : s,
|
|
31
|
+
markdownContent: t.isEmpty ? "" : g(s),
|
|
32
|
+
source: H ? "programmatic" : "user"
|
|
45
33
|
});
|
|
46
34
|
},
|
|
47
|
-
[
|
|
35
|
+
[e, l]
|
|
48
36
|
);
|
|
49
|
-
|
|
50
|
-
...
|
|
51
|
-
editable:
|
|
52
|
-
extensions: [...
|
|
37
|
+
u.current || (u.current = new T({
|
|
38
|
+
...o,
|
|
39
|
+
editable: e,
|
|
40
|
+
extensions: [...z(C), ...h ?? []],
|
|
53
41
|
editorProps: {
|
|
54
42
|
attributes: {
|
|
55
43
|
class: "scribe"
|
|
56
44
|
},
|
|
57
|
-
...
|
|
45
|
+
...o == null ? void 0 : o.editorProps
|
|
58
46
|
}
|
|
59
47
|
}));
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
}, []),
|
|
63
|
-
var
|
|
64
|
-
const
|
|
65
|
-
html: () =>
|
|
66
|
-
json: () =>
|
|
67
|
-
markdown: () =>
|
|
48
|
+
const n = u.current, b = m(() => {
|
|
49
|
+
n == null || n.commands.setContent("");
|
|
50
|
+
}, []), S = m((t) => {
|
|
51
|
+
var r;
|
|
52
|
+
const s = {
|
|
53
|
+
html: () => n == null ? void 0 : n.getHTML(),
|
|
54
|
+
json: () => n == null ? void 0 : n.getJSON(),
|
|
55
|
+
markdown: () => g((n == null ? void 0 : n.getHTML()) || "")
|
|
68
56
|
};
|
|
69
|
-
return
|
|
70
|
-
}, []),
|
|
71
|
-
|
|
57
|
+
return n != null && n.isEmpty ? "" : (r = s[t]) == null ? void 0 : r.call(s);
|
|
58
|
+
}, []), B = m((t) => {
|
|
59
|
+
n == null || n.commands.setContent(t);
|
|
72
60
|
}, []);
|
|
73
|
-
return D(
|
|
74
|
-
resetContent:
|
|
75
|
-
setContent:
|
|
76
|
-
getContent:
|
|
77
|
-
editor:
|
|
78
|
-
}), [
|
|
79
|
-
|
|
80
|
-
}, [
|
|
81
|
-
|
|
82
|
-
}, [
|
|
83
|
-
|
|
84
|
-
}), [
|
|
85
|
-
|
|
86
|
-
}, [
|
|
87
|
-
|
|
88
|
-
/* @__PURE__ */
|
|
61
|
+
return D(x, () => ({
|
|
62
|
+
resetContent: b,
|
|
63
|
+
setContent: B,
|
|
64
|
+
getContent: S,
|
|
65
|
+
editor: n
|
|
66
|
+
}), [b]), c(() => {
|
|
67
|
+
n == null || n.commands.setContent(E || "");
|
|
68
|
+
}, [E]), c(() => {
|
|
69
|
+
n == null || n.setEditable(!!e);
|
|
70
|
+
}, [e]), c(() => (n.off("update"), n.on("update", f), () => {
|
|
71
|
+
n.off("update", f);
|
|
72
|
+
}), [f]), c(() => {
|
|
73
|
+
d && (n == null || n.commands.focus("end"));
|
|
74
|
+
}, [d]), /* @__PURE__ */ a("div", { className: p("scribe-wrapper", j), style: N, children: /* @__PURE__ */ L("div", { className: p(e && "rounded-lg border", i ? "border-zinc-700" : "border-zinc-200"), children: [
|
|
75
|
+
n && w && /* @__PURE__ */ a(R, { editor: n, darkMode: !!i }),
|
|
76
|
+
/* @__PURE__ */ a(
|
|
89
77
|
"div",
|
|
90
78
|
{
|
|
91
|
-
className:
|
|
92
|
-
|
|
93
|
-
|
|
79
|
+
className: p(
|
|
80
|
+
"prose max-w-none",
|
|
81
|
+
e && "w-full p-[16px]",
|
|
82
|
+
i && "prose-invert",
|
|
83
|
+
M
|
|
84
|
+
),
|
|
85
|
+
style: y,
|
|
86
|
+
children: /* @__PURE__ */ a(J, { editor: n, onKeyDown: k })
|
|
94
87
|
}
|
|
95
88
|
)
|
|
96
89
|
] }) });
|
package/dist/main.css
CHANGED
|
@@ -949,6 +949,26 @@ video {
|
|
|
949
949
|
.prose :where(.prose > :last-child):not(:where([class~="not-prose"],[class~="not-prose"] *)) {
|
|
950
950
|
margin-bottom: 0;
|
|
951
951
|
}
|
|
952
|
+
.prose-invert {
|
|
953
|
+
--tw-prose-body: var(--tw-prose-invert-body);
|
|
954
|
+
--tw-prose-headings: var(--tw-prose-invert-headings);
|
|
955
|
+
--tw-prose-lead: var(--tw-prose-invert-lead);
|
|
956
|
+
--tw-prose-links: var(--tw-prose-invert-links);
|
|
957
|
+
--tw-prose-bold: var(--tw-prose-invert-bold);
|
|
958
|
+
--tw-prose-counters: var(--tw-prose-invert-counters);
|
|
959
|
+
--tw-prose-bullets: var(--tw-prose-invert-bullets);
|
|
960
|
+
--tw-prose-hr: var(--tw-prose-invert-hr);
|
|
961
|
+
--tw-prose-quotes: var(--tw-prose-invert-quotes);
|
|
962
|
+
--tw-prose-quote-borders: var(--tw-prose-invert-quote-borders);
|
|
963
|
+
--tw-prose-captions: var(--tw-prose-invert-captions);
|
|
964
|
+
--tw-prose-kbd: var(--tw-prose-invert-kbd);
|
|
965
|
+
--tw-prose-kbd-shadows: var(--tw-prose-invert-kbd-shadows);
|
|
966
|
+
--tw-prose-code: var(--tw-prose-invert-code);
|
|
967
|
+
--tw-prose-pre-code: var(--tw-prose-invert-pre-code);
|
|
968
|
+
--tw-prose-pre-bg: var(--tw-prose-invert-pre-bg);
|
|
969
|
+
--tw-prose-th-borders: var(--tw-prose-invert-th-borders);
|
|
970
|
+
--tw-prose-td-borders: var(--tw-prose-invert-td-borders);
|
|
971
|
+
}
|
|
952
972
|
.visible {
|
|
953
973
|
visibility: visible;
|
|
954
974
|
}
|
|
@@ -1010,17 +1030,25 @@ video {
|
|
|
1010
1030
|
.border-l {
|
|
1011
1031
|
border-left-width: 1px;
|
|
1012
1032
|
}
|
|
1013
|
-
.
|
|
1014
|
-
--tw-
|
|
1015
|
-
|
|
1033
|
+
.border-zinc-200 {
|
|
1034
|
+
--tw-border-opacity: 1;
|
|
1035
|
+
border-color: rgb(228 228 231 / var(--tw-border-opacity, 1));
|
|
1036
|
+
}
|
|
1037
|
+
.border-zinc-700 {
|
|
1038
|
+
--tw-border-opacity: 1;
|
|
1039
|
+
border-color: rgb(63 63 70 / var(--tw-border-opacity, 1));
|
|
1016
1040
|
}
|
|
1017
1041
|
.bg-gray-200 {
|
|
1018
1042
|
--tw-bg-opacity: 1;
|
|
1019
1043
|
background-color: rgb(229 231 235 / var(--tw-bg-opacity, 1));
|
|
1020
1044
|
}
|
|
1021
|
-
.bg-
|
|
1045
|
+
.bg-zinc-200 {
|
|
1022
1046
|
--tw-bg-opacity: 1;
|
|
1023
|
-
background-color: rgb(
|
|
1047
|
+
background-color: rgb(228 228 231 / var(--tw-bg-opacity, 1));
|
|
1048
|
+
}
|
|
1049
|
+
.bg-zinc-700 {
|
|
1050
|
+
--tw-bg-opacity: 1;
|
|
1051
|
+
background-color: rgb(63 63 70 / var(--tw-bg-opacity, 1));
|
|
1024
1052
|
}
|
|
1025
1053
|
.bg-opacity-50 {
|
|
1026
1054
|
--tw-bg-opacity: 0.5;
|
|
@@ -1043,6 +1071,10 @@ video {
|
|
|
1043
1071
|
.italic {
|
|
1044
1072
|
font-style: italic;
|
|
1045
1073
|
}
|
|
1074
|
+
.invert {
|
|
1075
|
+
--tw-invert: invert(100%);
|
|
1076
|
+
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);
|
|
1077
|
+
}
|
|
1046
1078
|
.filter {
|
|
1047
1079
|
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);
|
|
1048
1080
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "A Tiptap-based rich text editor with a Notion-style block interface for viewing and creating content. Perfect for diverse needs like notes, documents, AI chat, Markdown parsing, and comments.",
|
|
4
4
|
"author": "CleverTask",
|
|
5
5
|
"private": false,
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.10",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/main.js",
|
|
9
9
|
"types": "dist/main.d.ts",
|