@airalogy/aimd-editor 1.9.0 → 1.9.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/dist/embedded.js CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as s } from "./AimdSourceEditor.vue_vue_type_script_setup_true_lang-ttzw5IdG.js";
1
+ import { _ as s } from "./AimdSourceEditor.vue_vue_type_script_setup_true_lang-CHXbJJa_.js";
2
2
  import { _ as i, D as d, i as o, j as t, k as A, r as m } from "./AimdWysiwygEditor.vue_vue_type_script_setup_true_lang-BYUea59a.js";
3
3
  export {
4
4
  s as AimdSourceEditor,
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { A as i, a as s, b as d, D as o, K as m, M as r, c as t, d as A, e as n, f as l, g as D, l as E, s as T } from "./theme-B8dCnOx-.js";
2
- import { _, a as c, b as f, c as u, u as M } from "./AimdEditorTopBar.vue_vue_type_script_setup_true_lang-DUzstO_i.js";
3
- import { _ as p } from "./AimdSourceEditor.vue_vue_type_script_setup_true_lang-ttzw5IdG.js";
2
+ import { _, a as c, b as f, c as u, u as M } from "./AimdEditorTopBar.vue_vue_type_script_setup_true_lang-BL2zaxn-.js";
3
+ import { _ as p } from "./AimdSourceEditor.vue_vue_type_script_setup_true_lang-CHXbJJa_.js";
4
4
  import { A as k, a as x, _ as L, D as O, M as S, b as y, c as b, d as N, e as P, f as R, g as w, h, i as B, j as C, k as v, l as K, m as V, n as Y, r as j } from "./AimdWysiwygEditor.vue_vue_type_script_setup_true_lang-BYUea59a.js";
5
5
  export {
6
6
  k as AIMD_FIELD_TYPES,
package/dist/vue.js CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as e, a as d, b as s, c as r, u as o } from "./AimdEditorTopBar.vue_vue_type_script_setup_true_lang-DUzstO_i.js";
2
- import { _ as m } from "./AimdSourceEditor.vue_vue_type_script_setup_true_lang-ttzw5IdG.js";
1
+ import { _ as e, a as d, b as s, c as r, u as o } from "./AimdEditorTopBar.vue_vue_type_script_setup_true_lang-BL2zaxn-.js";
2
+ import { _ as m } from "./AimdSourceEditor.vue_vue_type_script_setup_true_lang-CHXbJJa_.js";
3
3
  import { A as E, a as l, _ as I, D as _, M as T, b as D, c as F, d as M, e as u, f as c, g as n, h as g, i as L, j as O, k as p, l as S, m as y, n as b, r as f } from "./AimdWysiwygEditor.vue_vue_type_script_setup_true_lang-BYUea59a.js";
4
4
  export {
5
5
  E as AIMD_FIELD_TYPES,
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@airalogy/aimd-editor",
3
3
  "type": "module",
4
- "version": "1.9.0",
4
+ "version": "1.9.1",
5
5
  "description": "AIMD (Airalogy Markdown) editor with Monaco source mode and Milkdown WYSIWYG mode",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/airalogy/aimd.git",
10
- "directory": "packages/aimd-editor"
9
+ "url": "https://github.com/airalogy/airalogy.git",
10
+ "directory": "packages/npm/aimd-editor"
11
11
  },
12
12
  "bugs": {
13
- "url": "https://github.com/airalogy/aimd/issues"
13
+ "url": "https://github.com/airalogy/airalogy/issues"
14
14
  },
15
- "homepage": "https://github.com/airalogy/aimd/tree/main/packages/aimd-editor#readme",
15
+ "homepage": "https://github.com/airalogy/airalogy/tree/main/packages/npm/aimd-editor#readme",
16
16
  "keywords": [
17
17
  "aimd",
18
18
  "monaco",
@@ -59,8 +59,8 @@
59
59
  "@milkdown/kit": "^7.18.0",
60
60
  "@milkdown/theme-nord": "^7.18.0",
61
61
  "@milkdown/vue": "^7.18.0",
62
- "@airalogy/aimd-core": "^2.6.0",
63
- "@airalogy/aimd-renderer": "^2.5.0"
62
+ "@airalogy/aimd-core": "^2.10.0",
63
+ "@airalogy/aimd-renderer": "^2.8.1"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "monaco-editor": ">=0.50.0",
@@ -19,6 +19,7 @@ import {
19
19
  createMdToolbarItems,
20
20
  getQuickAimdSyntax,
21
21
  type AimdEditorProps,
22
+ type AimdEditorImageRequest,
22
23
  } from './types'
23
24
  import { useEditorContent } from './useEditorContent'
24
25
 
@@ -31,6 +32,7 @@ const props = withDefaults(defineProps<AimdEditorProps>(), {
31
32
  showToolbar: true,
32
33
  showAimdToolbar: true,
33
34
  showMdToolbar: true,
35
+ imageToolbarAction: 'markdown',
34
36
  enableBlockHandle: true,
35
37
  enableSlashMenu: true,
36
38
  keepInactiveEditorsMounted: true,
@@ -43,6 +45,7 @@ const emit = defineEmits<{
43
45
  (e: 'update:modelValue', value: string): void
44
46
  (e: 'update:mode', mode: 'source' | 'wysiwyg'): void
45
47
  (e: 'ready', editor: { monaco?: any; milkdown?: Editor }): void
48
+ (e: 'request-image', request: AimdEditorImageRequest): void
46
49
  }>()
47
50
 
48
51
  // --- Resolved messages ---
@@ -126,6 +129,28 @@ function onDialogInsert(syntax: string) {
126
129
  insertTextIntoActiveEditor(syntax)
127
130
  }
128
131
 
132
+ function getToolbarButtonRect(target: EventTarget | null): AimdEditorImageRequest['buttonRect'] {
133
+ if (!(target instanceof HTMLElement)) return undefined
134
+ const rect = target.getBoundingClientRect()
135
+ return {
136
+ top: rect.top,
137
+ right: rect.right,
138
+ bottom: rect.bottom,
139
+ left: rect.left,
140
+ width: rect.width,
141
+ height: rect.height,
142
+ }
143
+ }
144
+
145
+ function handleMdToolbarAction(action: string, event: MouseEvent) {
146
+ if (action === 'image' && props.imageToolbarAction === 'custom') {
147
+ emit('request-image', { buttonRect: getToolbarButtonRect(event.currentTarget) })
148
+ return
149
+ }
150
+
151
+ handleMdAction(action)
152
+ }
153
+
129
154
  // --- Source editor refs ---
130
155
  const sourceEditorRef = ref<InstanceType<typeof AimdSourceEditor> | null>(null)
131
156
  const wysiwygEditorRef = ref<InstanceType<typeof AimdWysiwygEditor> | null>(null)
@@ -180,7 +205,7 @@ defineExpose({
180
205
  :localized-field-types="localizedFieldTypes"
181
206
  :localized-md-toolbar-items="localizedMdToolbarItems"
182
207
  @switch-mode="switchMode"
183
- @md-action="handleMdAction"
208
+ @md-action="handleMdToolbarAction"
184
209
  @open-aimd-dialog="openAimdDialog"
185
210
  @quick-insert-aimd="quickInsertAimd"
186
211
  />
@@ -14,7 +14,7 @@ defineProps<{
14
14
 
15
15
  const emit = defineEmits<{
16
16
  (e: 'switch-mode', mode: 'source' | 'wysiwyg'): void
17
- (e: 'md-action', action: string): void
17
+ (e: 'md-action', action: string, event: MouseEvent): void
18
18
  (e: 'open-aimd-dialog', type: string): void
19
19
  (e: 'quick-insert-aimd', type: string): void
20
20
  }>()
@@ -55,7 +55,7 @@ const emit = defineEmits<{
55
55
  type="button"
56
56
  class="aimd-editor-fmt-btn"
57
57
  :title="item.title"
58
- @click="emit('md-action', item.action)"
58
+ @click="emit('md-action', item.action, $event)"
59
59
  v-html="item.svgIcon"
60
60
  />
61
61
  </template>
package/src/vue/index.ts CHANGED
@@ -25,6 +25,9 @@ export {
25
25
  export type {
26
26
  AimdFieldTypeDefinition,
27
27
  AimdFieldType,
28
+ AimdEditorImageToolbarAction,
29
+ AimdEditorImageRequest,
30
+ AimdEditorToolbarButtonRect,
28
31
  AimdVarTypePresetOption,
29
32
  MdToolbarItemDefinition,
30
33
  MdToolbarItem,
package/src/vue/types.ts CHANGED
@@ -36,6 +36,21 @@ export interface MdToolbarItem extends MdToolbarItemDefinition {
36
36
  title?: string
37
37
  }
38
38
 
39
+ export type AimdEditorImageToolbarAction = 'markdown' | 'custom'
40
+
41
+ export interface AimdEditorToolbarButtonRect {
42
+ top: number
43
+ right: number
44
+ bottom: number
45
+ left: number
46
+ width: number
47
+ height: number
48
+ }
49
+
50
+ export interface AimdEditorImageRequest {
51
+ buttonRect?: AimdEditorToolbarButtonRect
52
+ }
53
+
39
54
  export interface AimdEditorProps {
40
55
  /** Initial / bound markdown content (v-model) */
41
56
  modelValue?: string
@@ -55,6 +70,8 @@ export interface AimdEditorProps {
55
70
  showAimdToolbar?: boolean
56
71
  /** Whether to show the Markdown toolbar section */
57
72
  showMdToolbar?: boolean
73
+ /** How the Markdown image toolbar button behaves */
74
+ imageToolbarAction?: AimdEditorImageToolbarAction
58
75
  /** Whether to enable the Milkdown block handle (plus button on left) */
59
76
  enableBlockHandle?: boolean
60
77
  /** Whether to enable the slash menu (type / to insert) */
@@ -75,6 +92,7 @@ export interface AimdEditorEmits {
75
92
  (e: 'update:modelValue', value: string): void
76
93
  (e: 'update:mode', mode: 'source' | 'wysiwyg'): void
77
94
  (e: 'ready', editor: { monaco?: any; milkdown?: Editor }): void
95
+ (e: 'request-image', request: AimdEditorImageRequest): void
78
96
  }
79
97
 
80
98
  // SVG icon helpers – all 16×16, stroke-based, currentColor