@qnroa/qtype 0.1.1 → 0.1.3

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 CHANGED
@@ -13,6 +13,49 @@ can land in any minor bump (`0.x.0`).
13
13
 
14
14
  ## [Unreleased]
15
15
 
16
+ ## [0.1.3] — 2026-08-28
17
+
18
+ Adds markdown link support to the display-side renderer. Typing
19
+ targets are untouched — links only render in descriptive slots
20
+ (`## Q` prompts, article / snippet bodies, gloss), never in `## A`
21
+ or any other slot the engine reads as target text.
22
+
23
+ ### Added
24
+ - **Standard `[label](url)` markdown links.** External URLs (`http(s)://`,
25
+ `//`) open in a new tab with `rel="noopener noreferrer"`; relative
26
+ URLs stay in-place. Styled via `.qt-md-link` — underlined, accent-
27
+ coloured, no extra layout impact.
28
+ - Image regex (`![...](...)`) runs before the link regex so `!` prefix
29
+ wins; a negative lookbehind on the link regex prevents cross-match.
30
+
31
+ ### Notes
32
+ - The engine (`TypingInput`) is not touched. Card answers still compare
33
+ character-by-character. Only the *rendered preview* on the Q side
34
+ gets the link.
35
+
36
+ Fixes iOS Safari (and some Android IMEs) where soft-keyboard keys
37
+ (Space, Enter, Backspace) silently did nothing. The engine received
38
+ no event because these browsers don't fire `keydown` for keys
39
+ committed outside an active composition — they only arrive via
40
+ `beforeinput`, which the old handler `preventDefault`'d without
41
+ dispatching.
42
+
43
+ ### Fixed
44
+ - **Space key works on iPhone / iPad Chinese keyboards.** SPACE and
45
+ any printable char arriving as `beforeinput insertText` outside of
46
+ an active composition is now dispatched to the engine. Previously
47
+ the key felt "dead" — users had to swap to the English keyboard
48
+ just to type a space between words.
49
+ - **Enter / Return key works on iPhone / iPad.** `insertLineBreak`
50
+ and `insertParagraph` from `beforeinput` now dispatch as `enter`.
51
+ - **Backspace works on iPhone / iPad.** `deleteContentBackward`,
52
+ `deleteWordBackward`, and `deleteSoftLineBackward` from
53
+ `beforeinput` now dispatch as `backspace`.
54
+ - **De-duplication for browsers that fire both events.** Desktop
55
+ browsers fire `keydown` AND a follow-up `beforeinput` for the same
56
+ keystroke. A 50ms guard prevents a double-emit across all three
57
+ paths (char, enter, backspace).
58
+
16
59
  ## [0.1.1] — 2026-08-28
17
60
 
18
61
  Fixes typing comparison for equivalent-but-different characters that
package/CHANGELOG.zh.md CHANGED
@@ -12,6 +12,41 @@ English: [CHANGELOG.md](https://www.npmjs.com/package/@qnroa/qtype?activeTab=cod
12
12
 
13
13
  ## [Unreleased]
14
14
 
15
+ ## [0.1.3] — 2026-08-28
16
+
17
+ 在显示侧渲染器加了 markdown 链接支持。打字目标不动 —— 链接只在
18
+ 描述性 slot(`## Q`、article/snippet 正文、gloss)里生效,`## A`
19
+ 以及其他被引擎当作打字目标的 slot 从不走这条路径。
20
+
21
+ ### 新增
22
+ - **标准 `[label](url)` markdown 链接**。外部 URL(`http(s)://`、`//`
23
+ 开头)在新 tab 打开,带 `rel="noopener noreferrer"`;相对 URL 在
24
+ 当前页面。样式在 `.qt-md-link` —— 下划线、accent 色,不占额外
25
+ 布局空间。
26
+ - 图片正则 `![...](...)` 先跑,`!` 前缀优先;link 正则加了负向后瞻
27
+ 防止串匹配。
28
+
29
+ ### 说明
30
+ - 打字引擎 `TypingInput` 未改。答案卡片仍按字符逐位比对。**只有 Q
31
+ 的渲染预览**会看到超链接。
32
+
33
+ 修复 iOS Safari(以及部分 Android 输入法)上软键盘的 Space / Enter /
34
+ Backspace 键"没反应"的问题。这些键在 composition 结束外按下时
35
+ **不触发** `keydown`,只通过 `beforeinput` 到达;旧代码只
36
+ `preventDefault` 没派发给引擎,用户以为键坏了。
37
+
38
+ ### 修复
39
+ - **iPhone / iPad 上空格键可用**。软键盘 `insertText` 现在会派发
40
+ 给引擎。之前必须切到英文键盘才能在单词间打空格。
41
+ - **iPhone / iPad 上 Enter/Return 可用**。`insertLineBreak` /
42
+ `insertParagraph` 现在派发为 `enter`。
43
+ - **iPhone / iPad 上 Backspace 可用**。`deleteContentBackward` /
44
+ `deleteWordBackward` / `deleteSoftLineBackward` 现在派发为
45
+ `backspace`。
46
+ - **桌面浏览器双触发去重**。桌面 `keydown` + `beforeinput` 同一次按
47
+ 键会双触发,加了 50ms 时间戳去重,char/enter/backspace 三条路径
48
+ 都覆盖。
49
+
15
50
  ## [0.1.1] — 2026-08-28
16
51
 
17
52
  修复输入法/终端产出的等价字符(中文输入法下的全角空格、macOS/iOS