@forgedevstack/ink 1.0.0
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/CHANGELOG.md +13 -0
- package/LICENSE +21 -0
- package/README.md +83 -0
- package/dist/angular/index.cjs +30 -0
- package/dist/angular/index.d.ts +16 -0
- package/dist/angular/index.d.ts.map +1 -0
- package/dist/angular/index.js +39 -0
- package/dist/components/InkEditor/InkEditor.cjs +1 -0
- package/dist/components/InkEditor/InkEditor.d.ts +4 -0
- package/dist/components/InkEditor/InkEditor.d.ts.map +1 -0
- package/dist/components/InkEditor/InkEditor.js +225 -0
- package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.cjs +1 -0
- package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.d.ts +4 -0
- package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.js +22 -0
- package/dist/components/InkEditor/components/ToolbarButton/index.d.ts +2 -0
- package/dist/components/InkEditor/components/ToolbarButton/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ToolbarColorPicker/ToolbarColorPicker.cjs +1 -0
- package/dist/components/InkEditor/components/ToolbarColorPicker/ToolbarColorPicker.d.ts +4 -0
- package/dist/components/InkEditor/components/ToolbarColorPicker/ToolbarColorPicker.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ToolbarColorPicker/ToolbarColorPicker.js +24 -0
- package/dist/components/InkEditor/components/ToolbarColorPicker/index.d.ts +2 -0
- package/dist/components/InkEditor/components/ToolbarColorPicker/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.cjs +1 -0
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.d.ts +4 -0
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.js +21 -0
- package/dist/components/InkEditor/components/ToolbarDropdown/index.d.ts +2 -0
- package/dist/components/InkEditor/components/ToolbarDropdown/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/index.d.ts +4 -0
- package/dist/components/InkEditor/components/index.d.ts.map +1 -0
- package/dist/components/InkEditor/helpers/format.utils.cjs +1 -0
- package/dist/components/InkEditor/helpers/format.utils.d.ts +13 -0
- package/dist/components/InkEditor/helpers/format.utils.d.ts.map +1 -0
- package/dist/components/InkEditor/helpers/format.utils.js +26 -0
- package/dist/components/InkEditor/helpers/index.d.ts +2 -0
- package/dist/components/InkEditor/helpers/index.d.ts.map +1 -0
- package/dist/components/InkEditor/index.d.ts +3 -0
- package/dist/components/InkEditor/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/constants/defaults.const.cjs +1 -0
- package/dist/constants/defaults.const.d.ts +19 -0
- package/dist/constants/defaults.const.d.ts.map +1 -0
- package/dist/constants/defaults.const.js +81 -0
- package/dist/constants/index.d.ts +4 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/numbers.const.cjs +1 -0
- package/dist/constants/numbers.const.d.ts +5 -0
- package/dist/constants/numbers.const.d.ts.map +1 -0
- package/dist/constants/numbers.const.js +6 -0
- package/dist/constants/typos.const.cjs +1 -0
- package/dist/constants/typos.const.d.ts +3 -0
- package/dist/constants/typos.const.d.ts.map +1 -0
- package/dist/constants/typos.const.js +26 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/plugins/ai/aiPlugin.cjs +1 -0
- package/dist/plugins/ai/aiPlugin.d.ts +4 -0
- package/dist/plugins/ai/aiPlugin.d.ts.map +1 -0
- package/dist/plugins/ai/aiPlugin.js +22 -0
- package/dist/plugins/ai/index.cjs +1 -0
- package/dist/plugins/ai/index.d.ts +3 -0
- package/dist/plugins/ai/index.d.ts.map +1 -0
- package/dist/plugins/ai/index.js +5 -0
- package/dist/styles.css +149 -0
- package/dist/types/ai.types.d.ts +25 -0
- package/dist/types/ai.types.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/ink.types.d.ts +48 -0
- package/dist/types/ink.types.d.ts.map +1 -0
- package/dist/utils/cn.utils.cjs +1 -0
- package/dist/utils/cn.utils.d.ts +2 -0
- package/dist/utils/cn.utils.d.ts.map +1 -0
- package/dist/utils/cn.utils.js +4 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/typo.utils.cjs +1 -0
- package/dist/utils/typo.utils.d.ts +3 -0
- package/dist/utils/typo.utils.d.ts.map +1 -0
- package/dist/utils/typo.utils.js +15 -0
- package/dist/utils/typo.utils.test.d.ts +2 -0
- package/dist/utils/typo.utils.test.d.ts.map +1 -0
- package/package.json +89 -0
- package/wordpress/README.md +13 -0
- package/wordpress/ink-editor/assets/.gitkeep +0 -0
- package/wordpress/ink-editor/ink-editor.php +92 -0
package/package.json
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@forgedevstack/ink",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "ForgeStack rich text editor for React — WYSIWYG toolbar, typo auto-fix, Angular adapter, and WordPress stub. The writing layer of ForgeStack.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
|
+
"require": "./dist/index.cjs"
|
|
17
|
+
},
|
|
18
|
+
"./angular": {
|
|
19
|
+
"types": "./dist/angular/index.d.ts",
|
|
20
|
+
"import": "./dist/angular/index.js",
|
|
21
|
+
"require": "./dist/angular/index.cjs"
|
|
22
|
+
},
|
|
23
|
+
"./plugins/ai": {
|
|
24
|
+
"types": "./dist/plugins/ai/index.d.ts",
|
|
25
|
+
"import": "./dist/plugins/ai/index.js",
|
|
26
|
+
"require": "./dist/plugins/ai/index.cjs"
|
|
27
|
+
},
|
|
28
|
+
"./styles.css": "./dist/styles.css"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"README.md",
|
|
33
|
+
"CHANGELOG.md",
|
|
34
|
+
"LICENSE",
|
|
35
|
+
"wordpress"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"dev": "vite build --watch",
|
|
39
|
+
"build": "tsc --noEmit && vite build && node scripts/copy-styles.mjs",
|
|
40
|
+
"typecheck": "tsc --noEmit",
|
|
41
|
+
"test": "vitest run",
|
|
42
|
+
"prepublishOnly": "npm run build"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"react": ">=18.0.0",
|
|
46
|
+
"react-dom": ">=18.0.0"
|
|
47
|
+
},
|
|
48
|
+
"peerDependenciesMeta": {
|
|
49
|
+
"@angular/core": {
|
|
50
|
+
"optional": true
|
|
51
|
+
},
|
|
52
|
+
"@angular/common": {
|
|
53
|
+
"optional": true
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@types/react": "^18.3.18",
|
|
58
|
+
"@types/react-dom": "^18.3.5",
|
|
59
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
60
|
+
"react": "^18.3.1",
|
|
61
|
+
"react-dom": "^18.3.1",
|
|
62
|
+
"typescript": "^5.7.3",
|
|
63
|
+
"vite": "^6.0.7",
|
|
64
|
+
"vite-plugin-dts": "^4.4.0",
|
|
65
|
+
"vitest": "^2.1.8"
|
|
66
|
+
},
|
|
67
|
+
"keywords": [
|
|
68
|
+
"react",
|
|
69
|
+
"rich-text",
|
|
70
|
+
"wysiwyg",
|
|
71
|
+
"editor",
|
|
72
|
+
"contenteditable",
|
|
73
|
+
"typescript",
|
|
74
|
+
"forge",
|
|
75
|
+
"ink",
|
|
76
|
+
"angular",
|
|
77
|
+
"wordpress"
|
|
78
|
+
],
|
|
79
|
+
"author": "John Yaghobieh",
|
|
80
|
+
"license": "MIT",
|
|
81
|
+
"repository": {
|
|
82
|
+
"type": "git",
|
|
83
|
+
"url": "https://github.com/yaghobieh/ink.git"
|
|
84
|
+
},
|
|
85
|
+
"homepage": "https://inkforgejs.com",
|
|
86
|
+
"bugs": {
|
|
87
|
+
"url": "https://github.com/yaghobieh/ink/issues"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Ink WordPress plugin (stub)
|
|
2
|
+
|
|
3
|
+
MVP classic meta box that stores HTML in `_ink_editor_html`.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
1. Copy `wordpress/ink-editor/` into `wp-content/plugins/ink-editor/`.
|
|
8
|
+
2. Optionally copy a browser build of Ink into `assets/ink-editor.js` and `assets/ink-editor.css`.
|
|
9
|
+
3. Activate **Ink Editor** in WordPress admin.
|
|
10
|
+
|
|
11
|
+
## Domain
|
|
12
|
+
|
|
13
|
+
Docs and marketing use **inkforgejs.com** (placeholder — register at your registrar).
|
|
File without changes
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Plugin Name: Ink Editor
|
|
4
|
+
* Plugin URI: https://inkforgejs.com
|
|
5
|
+
* Description: ForgeStack Ink rich text editor for WordPress — classic meta box MVP that enqueues the built Ink bundle.
|
|
6
|
+
* Version: 1.0.0
|
|
7
|
+
* Author: John Yaghobieh
|
|
8
|
+
* License: MIT
|
|
9
|
+
* Text Domain: ink-editor
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
if (!defined('ABSPATH')) {
|
|
13
|
+
exit;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
define('INK_EDITOR_VERSION', '1.0.0');
|
|
17
|
+
define('INK_EDITOR_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
|
18
|
+
define('INK_EDITOR_PLUGIN_URL', plugin_dir_url(__FILE__));
|
|
19
|
+
|
|
20
|
+
function ink_editor_enqueue_assets($hook) {
|
|
21
|
+
if ($hook !== 'post.php' && $hook !== 'post-new.php') {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
$js = INK_EDITOR_PLUGIN_DIR . 'assets/ink-editor.js';
|
|
26
|
+
$css = INK_EDITOR_PLUGIN_DIR . 'assets/ink-editor.css';
|
|
27
|
+
|
|
28
|
+
if (file_exists($css)) {
|
|
29
|
+
wp_enqueue_style(
|
|
30
|
+
'ink-editor',
|
|
31
|
+
INK_EDITOR_PLUGIN_URL . 'assets/ink-editor.css',
|
|
32
|
+
array(),
|
|
33
|
+
INK_EDITOR_VERSION
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (file_exists($js)) {
|
|
38
|
+
wp_enqueue_script(
|
|
39
|
+
'ink-editor',
|
|
40
|
+
INK_EDITOR_PLUGIN_URL . 'assets/ink-editor.js',
|
|
41
|
+
array(),
|
|
42
|
+
INK_EDITOR_VERSION,
|
|
43
|
+
true
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
add_action('admin_enqueue_scripts', 'ink_editor_enqueue_assets');
|
|
48
|
+
|
|
49
|
+
function ink_editor_add_meta_box() {
|
|
50
|
+
add_meta_box(
|
|
51
|
+
'ink_editor_meta',
|
|
52
|
+
__('Ink Editor', 'ink-editor'),
|
|
53
|
+
'ink_editor_render_meta_box',
|
|
54
|
+
array('post', 'page'),
|
|
55
|
+
'normal',
|
|
56
|
+
'high'
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
add_action('add_meta_boxes', 'ink_editor_add_meta_box');
|
|
60
|
+
|
|
61
|
+
function ink_editor_render_meta_box($post) {
|
|
62
|
+
wp_nonce_field('ink_editor_save', 'ink_editor_nonce');
|
|
63
|
+
$value = get_post_meta($post->ID, '_ink_editor_html', true);
|
|
64
|
+
?>
|
|
65
|
+
<div id="ink-editor-root"
|
|
66
|
+
data-ink-value="<?php echo esc_attr($value); ?>"
|
|
67
|
+
style="min-height:220px;border:1px solid #d0d5dd;border-radius:8px;padding:12px;background:#fff;">
|
|
68
|
+
<p style="color:#667085;margin:0 0 8px;">
|
|
69
|
+
<?php esc_html_e('Ink WordPress stub (1.0.0): paste HTML below or replace assets/ with the published Ink UMD/IIFE build.', 'ink-editor'); ?>
|
|
70
|
+
</p>
|
|
71
|
+
<textarea name="ink_editor_html" rows="10" style="width:100%;font-family:ui-monospace,monospace;"><?php echo esc_textarea($value); ?></textarea>
|
|
72
|
+
</div>
|
|
73
|
+
<?php
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function ink_editor_save_meta_box($post_id) {
|
|
77
|
+
if (!isset($_POST['ink_editor_nonce']) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['ink_editor_nonce'])), 'ink_editor_save')) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (!current_user_can('edit_post', $post_id)) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (!isset($_POST['ink_editor_html'])) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
$html = wp_kses_post(wp_unslash($_POST['ink_editor_html']));
|
|
90
|
+
update_post_meta($post_id, '_ink_editor_html', $html);
|
|
91
|
+
}
|
|
92
|
+
add_action('save_post', 'ink_editor_save_meta_box');
|