@qirtaas/react 0.0.1
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/LICENSE +21 -0
- package/README.md +49 -0
- package/dist/qirtaas-react.js +77315 -0
- package/dist/qirtaas.css +1 -0
- package/package.json +53 -0
- package/src/QirtaasEditor.ts +111 -0
- package/src/QirtaasRenderer.ts +77 -0
- package/src/index.ts +27 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Alrimaal
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# @qirtaas/react
|
|
2
|
+
|
|
3
|
+
Idiomatic React components wrapping the [`@qirtaas/core`](https://www.npmjs.com/package/@qirtaas/core)
|
|
4
|
+
embeddable rich-text editor. Vue is bundled in (a React host supplies none);
|
|
5
|
+
only `react` and `react-dom` are peer dependencies.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @qirtaas/react
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Requires React 18+.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { useRef } from "react";
|
|
19
|
+
import { QirtaasEditor, type QirtaasEditorHandle } from "@qirtaas/react";
|
|
20
|
+
import "@qirtaas/react/qirtaas.css";
|
|
21
|
+
|
|
22
|
+
export default function App() {
|
|
23
|
+
const editorRef = useRef<QirtaasEditorHandle>(null);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<QirtaasEditor
|
|
27
|
+
ref={editorRef}
|
|
28
|
+
apiUrl="https://api.example.com"
|
|
29
|
+
getToken={() => fetchEmbedJwt()} // required: called on init, before expiry, on 401
|
|
30
|
+
documentId="<uuid>"
|
|
31
|
+
locale="en"
|
|
32
|
+
theme="light"
|
|
33
|
+
onReady={() => console.log("ready")}
|
|
34
|
+
onChange={(json) => console.log(json)}
|
|
35
|
+
onSaveStateChange={(state) => console.log(state)}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
A read-only `QirtaasRenderer` is also exported, along with `createQirtaasClient`
|
|
42
|
+
for imperative, mount-less operations (e.g. `deleteDocument` from a list view).
|
|
43
|
+
|
|
44
|
+
The editor is a self-contained island — the host needs no Vue. The wrapper is
|
|
45
|
+
StrictMode-safe (each cleanup fully destroys the editor).
|
|
46
|
+
|
|
47
|
+
## License
|
|
48
|
+
|
|
49
|
+
MIT
|