@qarakash/blockwriteai 1.0.8 → 1.0.9
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 +15 -15
- package/dist/blockwriteai.js +1 -1
- package/dist/plugins/blockwriteai-ai.js +58 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -68,11 +68,11 @@ BlockWriteAI can be consumed as a CDN/script-link package, an npm package, a Pyt
|
|
|
68
68
|
Use the npm CDN for a locked release build:
|
|
69
69
|
|
|
70
70
|
```html
|
|
71
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@qarakash/blockwriteai@1.0.
|
|
71
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@qarakash/blockwriteai@1.0.9/dist/blockwriteai.css">
|
|
72
72
|
|
|
73
|
-
<script src="https://cdn.jsdelivr.net/npm/@qarakash/blockwriteai@1.0.
|
|
74
|
-
<script src="https://cdn.jsdelivr.net/npm/@qarakash/blockwriteai@1.0.
|
|
75
|
-
<script src="https://cdn.jsdelivr.net/npm/@qarakash/blockwriteai@1.0.
|
|
73
|
+
<script src="https://cdn.jsdelivr.net/npm/@qarakash/blockwriteai@1.0.9/dist/blockwriteai.js"></script>
|
|
74
|
+
<script src="https://cdn.jsdelivr.net/npm/@qarakash/blockwriteai@1.0.9/dist/plugins/blockwriteai-code-assist.js"></script>
|
|
75
|
+
<script src="https://cdn.jsdelivr.net/npm/@qarakash/blockwriteai@1.0.9/dist/plugins/blockwriteai-advanced-blocks.js"></script>
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
`blockwriteai-advanced-blocks.js` is the free advanced bundle. It includes Chart,
|
|
@@ -82,7 +82,7 @@ and AI are premium plugins and should not be loaded directly in production.
|
|
|
82
82
|
Load History only when a project needs the history dropdown:
|
|
83
83
|
|
|
84
84
|
```html
|
|
85
|
-
<script src="https://cdn.jsdelivr.net/npm/@qarakash/blockwriteai@1.0.
|
|
85
|
+
<script src="https://cdn.jsdelivr.net/npm/@qarakash/blockwriteai@1.0.9/dist/plugins/blockwriteai-history.js"></script>
|
|
86
86
|
```
|
|
87
87
|
|
|
88
88
|
For development against the current GitHub branch, replace the npm URLs with the
|
|
@@ -139,10 +139,10 @@ the license. The platform serves Drawing, Mermaid, Signature, Signature Flow,
|
|
|
139
139
|
and AI as a verified bundle after checking the requested feature flags:
|
|
140
140
|
|
|
141
141
|
```html
|
|
142
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@qarakash/blockwriteai@1.0.
|
|
143
|
-
<script src="https://cdn.jsdelivr.net/npm/@qarakash/blockwriteai@1.0.
|
|
144
|
-
<script src="https://cdn.jsdelivr.net/npm/@qarakash/blockwriteai@1.0.
|
|
145
|
-
<script src="https://cdn.jsdelivr.net/npm/@qarakash/blockwriteai@1.0.
|
|
142
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@qarakash/blockwriteai@1.0.9/dist/blockwriteai.css">
|
|
143
|
+
<script src="https://cdn.jsdelivr.net/npm/@qarakash/blockwriteai@1.0.9/dist/blockwriteai.js"></script>
|
|
144
|
+
<script src="https://cdn.jsdelivr.net/npm/@qarakash/blockwriteai@1.0.9/dist/plugins/blockwriteai-code-assist.js"></script>
|
|
145
|
+
<script src="https://cdn.jsdelivr.net/npm/@qarakash/blockwriteai@1.0.9/dist/plugins/blockwriteai-advanced-blocks.js"></script>
|
|
146
146
|
<script>
|
|
147
147
|
async function boot() {
|
|
148
148
|
await BlockWriteAI.loadPremiumPlugins({
|
|
@@ -195,8 +195,8 @@ import "@qarakash/blockwriteai/plugins/history";
|
|
|
195
195
|
After npm publishing, the same package is also available through npm CDNs:
|
|
196
196
|
|
|
197
197
|
```html
|
|
198
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@qarakash/blockwriteai@1.0.
|
|
199
|
-
<script src="https://cdn.jsdelivr.net/npm/@qarakash/blockwriteai@1.0.
|
|
198
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@qarakash/blockwriteai@1.0.9/dist/blockwriteai.css">
|
|
199
|
+
<script src="https://cdn.jsdelivr.net/npm/@qarakash/blockwriteai@1.0.9/dist/blockwriteai.js"></script>
|
|
200
200
|
```
|
|
201
201
|
|
|
202
202
|
### Python
|
|
@@ -456,7 +456,7 @@ The JSON endpoint can return either a BlockWriteAI document directly or an API w
|
|
|
456
456
|
"ok": true,
|
|
457
457
|
"data": {
|
|
458
458
|
"time": 1779540000000,
|
|
459
|
-
"version": "1.0.
|
|
459
|
+
"version": "1.0.9",
|
|
460
460
|
"blocks": []
|
|
461
461
|
}
|
|
462
462
|
}
|
|
@@ -560,7 +560,7 @@ BlockWriteAI.mountPreviews(); // Render JSON into .blockwriteai-preview containe
|
|
|
560
560
|
```json
|
|
561
561
|
{
|
|
562
562
|
"time": 1779540000000,
|
|
563
|
-
"version": "1.0.
|
|
563
|
+
"version": "1.0.9",
|
|
564
564
|
"blocks": [
|
|
565
565
|
{
|
|
566
566
|
"id": "block-title",
|
|
@@ -650,8 +650,8 @@ After a release is ready, publish each package from the repository root.
|
|
|
650
650
|
Create a Git release tag for script-link/CDN users:
|
|
651
651
|
|
|
652
652
|
```bash
|
|
653
|
-
git tag v1.0.
|
|
654
|
-
git push origin v1.0.
|
|
653
|
+
git tag v1.0.9
|
|
654
|
+
git push origin v1.0.9
|
|
655
655
|
```
|
|
656
656
|
|
|
657
657
|
Publish npm:
|
package/dist/blockwriteai.js
CHANGED
|
@@ -533,38 +533,70 @@
|
|
|
533
533
|
});
|
|
534
534
|
}
|
|
535
535
|
|
|
536
|
+
function ensureAIRefreshListener(editor) {
|
|
537
|
+
if (!editor || !editor.root || editor.__blockwriteaiAIRefreshBound) return;
|
|
538
|
+
editor.root.addEventListener("rbe:premium-change", refreshAIAvailability.bind(null, editor));
|
|
539
|
+
editor.__blockwriteaiAIRefreshBound = true;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
function ensureTopToolbarAIButton(editor, toolbar) {
|
|
543
|
+
toolbar = toolbar || (editor && editor.topToolbar);
|
|
544
|
+
if (!editor || editor.options.ai === false || !toolbar) return toolbar;
|
|
545
|
+
injectStyles();
|
|
546
|
+
if (!toolbar.querySelector(".rbe-ai-toolbar-btn")) {
|
|
547
|
+
toolbar.appendChild(
|
|
548
|
+
el("button", "rbe-history-btn rbe-ai-toolbar-btn", {
|
|
549
|
+
type: "button",
|
|
550
|
+
title: "BlockWriteAI",
|
|
551
|
+
html: faIcon("wand-magic-sparkles", "BlockWriteAI"),
|
|
552
|
+
dataset: { aiToolbar: "true", premiumFeature: "ai", unlockedTitle: "BlockWriteAI" }
|
|
553
|
+
})
|
|
554
|
+
);
|
|
555
|
+
}
|
|
556
|
+
ensureAIRefreshListener(editor);
|
|
557
|
+
refreshAIAvailability(editor);
|
|
558
|
+
return toolbar;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
function ensureInlineAIButton(editor, toolbar) {
|
|
562
|
+
toolbar = toolbar || (editor && editor.inlineToolbar);
|
|
563
|
+
if (!editor || editor.options.ai === false || !toolbar) return toolbar;
|
|
564
|
+
injectStyles();
|
|
565
|
+
if (!toolbar.querySelector(".rbe-ai-inline-btn")) {
|
|
566
|
+
toolbar.appendChild(
|
|
567
|
+
el("button", "rbe-ai-inline-btn", {
|
|
568
|
+
type: "button",
|
|
569
|
+
title: "BlockWriteAI",
|
|
570
|
+
html: faIcon("wand-magic-sparkles", "AI"),
|
|
571
|
+
dataset: { aiInline: "true", premiumFeature: "ai", unlockedTitle: "BlockWriteAI" }
|
|
572
|
+
})
|
|
573
|
+
);
|
|
574
|
+
}
|
|
575
|
+
ensureAIRefreshListener(editor);
|
|
576
|
+
refreshAIAvailability(editor);
|
|
577
|
+
return toolbar;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
function hydrateExistingEditors() {
|
|
581
|
+
if (typeof document === "undefined") return;
|
|
582
|
+
Array.prototype.slice.call(document.querySelectorAll(".rbe")).forEach(function (root) {
|
|
583
|
+
var editor = root.__blockwriteaiInstance;
|
|
584
|
+
if (!editor) return;
|
|
585
|
+
ensureTopToolbarAIButton(editor);
|
|
586
|
+
ensureInlineAIButton(editor);
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
|
|
536
590
|
var originalCreateTopToolbar = BlockWriteAI.prototype.createTopToolbar;
|
|
537
591
|
BlockWriteAI.prototype.createTopToolbar = function () {
|
|
538
592
|
var toolbar = originalCreateTopToolbar.call(this);
|
|
539
|
-
|
|
540
|
-
injectStyles();
|
|
541
|
-
toolbar.appendChild(
|
|
542
|
-
el("button", "rbe-history-btn rbe-ai-toolbar-btn", {
|
|
543
|
-
type: "button",
|
|
544
|
-
title: "BlockWriteAI",
|
|
545
|
-
html: faIcon("wand-magic-sparkles", "BlockWriteAI"),
|
|
546
|
-
dataset: { aiToolbar: "true", premiumFeature: "ai", unlockedTitle: "BlockWriteAI" }
|
|
547
|
-
})
|
|
548
|
-
);
|
|
549
|
-
refreshAIAvailability(this);
|
|
550
|
-
this.root.addEventListener("rbe:premium-change", refreshAIAvailability.bind(null, this));
|
|
551
|
-
return toolbar;
|
|
593
|
+
return ensureTopToolbarAIButton(this, toolbar);
|
|
552
594
|
};
|
|
553
595
|
|
|
554
596
|
var originalCreateInlineToolbar = BlockWriteAI.prototype.createInlineToolbar;
|
|
555
597
|
BlockWriteAI.prototype.createInlineToolbar = function () {
|
|
556
598
|
var toolbar = originalCreateInlineToolbar.call(this);
|
|
557
|
-
|
|
558
|
-
injectStyles();
|
|
559
|
-
var button = el("button", "rbe-ai-inline-btn", {
|
|
560
|
-
type: "button",
|
|
561
|
-
title: "BlockWriteAI",
|
|
562
|
-
html: faIcon("wand-magic-sparkles", "AI"),
|
|
563
|
-
dataset: { aiInline: "true", premiumFeature: "ai", unlockedTitle: "BlockWriteAI" }
|
|
564
|
-
});
|
|
565
|
-
toolbar.appendChild(button);
|
|
566
|
-
refreshAIAvailability(this);
|
|
567
|
-
return toolbar;
|
|
599
|
+
return ensureInlineAIButton(this, toolbar);
|
|
568
600
|
};
|
|
569
601
|
|
|
570
602
|
BlockWriteAI.prototype.openAI = function () {
|
|
@@ -633,5 +665,7 @@
|
|
|
633
665
|
return BlockWriteAI;
|
|
634
666
|
};
|
|
635
667
|
|
|
668
|
+
hydrateExistingEditors();
|
|
669
|
+
|
|
636
670
|
return BlockWriteAI;
|
|
637
671
|
});
|
package/package.json
CHANGED