Skip to content

한글/한자 변환 추가 - #86

Open
babyworm wants to merge 15 commits into
golbin:mainfrom
babyworm:main
Open

한글/한자 변환 추가#86
babyworm wants to merge 15 commits into
golbin:mainfrom
babyworm:main

Conversation

@babyworm

Copy link
Copy Markdown

아래아 한글에서 지원하는 F9/alt-F9를 통한 한글한자 변환 및 단어 제안, 음과 훈에 대한 설명 부분을 추가했습니다.

babyworm added 15 commits July 21, 2026 02:35
Pin reproducible character and word sources, generate sharded lookup data, and preserve source-specific licensing so the future F9 workflow can resolve whole words before falling back to per-syllable candidates.

Constraint: Keep third_party/rhwp read-only and avoid new package dependencies
Constraint: Standard and Basic Dictionary derivatives must remain CC BY-SA 2.0 KR
Rejected: Runtime-only NIKL API lookup | requires credentials, network access, and rate-limit handling
Rejected: Unverified 乓 퐁 reading | conflicts with the pinned libhangul reading and lacks Unihan Korean-reading support
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Regenerate data only from pinned sources and retain THIRD_PARTY_NOTICES.md with distributed word shards
Tested: corepack pnpm run dictionary:build; corepack pnpm run dictionary:verify; corepack pnpm run test:dictionary; deterministic rebuild comparison
Not-tested: Full Studio build because local node_modules and the upstream submodule are unavailable
…editor

F9 now prefers exact bundled word candidates, falls back to labeled per-syllable choices, and applies the selected result through one undo-aware editor command. The modal follows HOP's listbox, focus, theme, and keyboard contracts while the loader fetches only the required word shard.

Constraint: third_party/rhwp remains read-only and runtime conversion must work without API keys or network services
Rejected: Runtime National Institute of Korean Language API lookup | latency, availability, credentials, and redistribution behavior would make F9 non-deterministic
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep dictionary schema changes synchronized with the lazy loader and docs/architecture/HANJA_DATABASE.md
Tested: pnpm test; pnpm run build:studio; pnpm run clippy:desktop; pnpm run dictionary:verify
Not-tested: Manual packaged-app interaction on Windows and Linux
…ates

Align replacement ranges with the document core's Unicode character model, cancel stale work across document generations, and exclude unsupported form-mode edits. Tighten the offline dictionary contract so only aligned safe candidates ship, while preserving bounded asset diagnostics and manifest-driven loading.

Constraint: Keep third_party/rhwp read-only and retain deterministic offline conversion

Rejected: Allow replaceText in form mode by masquerading as an upstream primitive | would bypass the form-field authorization contract

Confidence: high

Scope-risk: moderate

Reversibility: clean

Directive: Keep Unicode scalar-count tests and dictionary safety invariants when changing replacement or source parsing

Tested: pnpm test; pnpm run build:studio; pnpm run clippy:desktop; pnpm run dictionary:verify; deterministic dictionary rebuild digest

Not-tested: Manual packaged-app F9 interaction on Windows and Linux
Hanja replacement now preserves text and character styles through reversible editor commands, rejects stale selections after document replacement, scopes F9 capture to a live editor, and validates bounded dictionary assets before exposing candidates. The reviewed UI and database contracts are recorded alongside regression coverage.

Constraint: Keep third_party/rhwp read-only and preserve cross-platform editor behavior.
Rejected: Whole-document snapshots | the shared snapshot store is bounded and couples undo safety to unrelated document operations.
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep conversion replacement on editor commands and invalidate captured ranges whenever the primary document generation changes.
Tested: upstream 25 tests, dictionary 3 tests, Studio 241 tests, TypeScript typecheck, Studio production build, Rust 1.93.1 MinGW x86_64-pc-windows-gnu all-targets check, browser WASM conversion and undo smoke tests.
Not-tested: Installed bundle runtime on a physical Windows host.
Desktop WebViews do not always report function keys through the same keyboard fields or event target, so F9 now accepts the supported key representations while retaining editor-focus and IME safety gates. The existing conversion command is also exposed through a Hangul-sensitive context submenu, the Input menu, and a toolbar button next to Character Table.\n\nConstraint: Keep third_party/rhwp read-only and preserve the upstream adapter boundary\nRejected: Register F9 as a global desktop shortcut | would steal the key outside the active editor and bypass IME focus guards\nConfidence: high\nScope-risk: moderate\nReversibility: clean\nDirective: Keep all Hanja entry points routed through edit:convert-hanja so context and replacement safety checks remain centralized\nTested: pnpm test; pnpm run build:studio; pnpm run clippy:desktop; pnpm run build:desktop\nNot-tested: Physical function-key delivery under every macOS keyboard preference and every supported Linux desktop
The bundled character records already contain Korean readings and meanings, but conversion entry points rejected Hanja sources. Route contiguous Hanja selections and caret runs through a per-character reverse lookup, preserving the existing undo-safe replacement path and shared dialog navigation.

Constraint: Keep third_party/rhwp read-only and preserve scalar-aligned replacement.

Rejected: Build a reverse whole-word index | word shards do not encode enough pronunciation context to safely infer 두음법칙.

Confidence: high

Scope-risk: moderate

Reversibility: clean

Directive: Keep reverse conversion character-based until a pronunciation-aware word source is introduced.

Tested: pnpm test; pnpm run clippy:desktop; pnpm run build:desktop; focused 70 Vitest cases

Not-tested: Manual keyboard and native context-menu interaction on Windows and Linux
Forward and reverse conversion shared one F9 capture path, which made the direction ambiguous. Classify the captured chord before dispatch so F9 remains Hangul-to-Hanja while macOS Option+F9 and Windows Alt+F8 explicitly request Hanja-to-Hangul.

Constraint: Preserve the upstream input handler and keep third_party/rhwp read-only.

Rejected: Let F9 infer both directions | it conflicts with the established reverse-conversion shortcut model.

Confidence: high

Scope-risk: narrow

Reversibility: clean

Directive: Keep shortcut direction parameters aligned with the source-direction guard.

Tested: pnpm test; pnpm run clippy:desktop; pnpm run build:desktop; focused shortcut and Hanja tests

Not-tested: Physical Windows keyboard and Linux window-manager shortcut interception
Pin remote source sizes and the Standard Dictionary source digest, bound downloads and ZIP expansion, and authenticate the bundled manifest and each loaded asset before JSON parsing. Publish complete redistribution notices with the trust anchor.

Constraint: Hanja conversion must remain offline, deterministic, dependency-free, and HOP-owned.
Rejected: Trust generated assets because they ship inside the app | parseable but substituted bytes would escape review.
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Regenerate manifest.json, hanja-dictionary-trust.json, and redistribution notices as one reviewed change.
Tested: pnpm run dictionary:verify; pnpm run test:dictionary; focused Hanja dictionary Vitest; pnpm run build:studio
Not-tested: Live regeneration from remote source services
Reject incompatible offsets, fields, and oversized ranges before lookup. Stage replacements while source text remains recoverable, preserve recovered undo and redo commands, and cancel dialogs or delayed lookups when document or input ownership changes.

Constraint: third_party/rhwp is read-only and every failure path must preserve document text, character styles, and current-document focus ownership.
Rejected: Retry a recovered transition | a second mutation can duplicate text and cannot safely restore history ownership.
Rejected: Guard modal keys on document capture | upstream registers there first and consumes F11 before the modal.
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Update the pinned upstream private-input baseline whenever cursor, history, or input compatibility access changes.
Tested: 130 focused Studio tests; 288 full Studio tests; pnpm run build:studio; git diff --check
Not-tested: Packaged-app undo and redo failure injection or physical desktop F11 delivery
Use one reverse-conversion chord across desktop platforms and keep menu, toolbar, tests, and keyboard guidance aligned with the captured command.

Constraint: Linux window managers may reserve Alt+F9, so menu and toolbar entry points remain required.
Rejected: Retain the Windows-only Alt+F8 variant | platform-specific routing makes the command and labels inconsistent.
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep capture matching, rendered labels, and keyboard documentation on the same chord.
Tested: focused shortcut and entry-point Vitest; 288 full Studio tests; pnpm run build:studio
Not-tested: Physical keyboard delivery on every supported desktop
Pin the cursor, history, input-handler, context-menu, and shared-style inputs that HOP adapters depend on. Canonicalize tracked text across LF and CRLF and report changed private inputs during stable-tag updates.

Constraint: Upstream verification must remain deterministic across macOS, Windows, and Linux checkouts.
Rejected: Track only fork and extension counterparts | private fields and shared DOM or CSS contracts can break without changing an override.
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Add every new private upstream dependency to studioPrivateInputIds before relying on it.
Tested: node --test tests/update-upstream.test.mjs tests/rhwp-baseline.test.mjs; pnpm upstream:verify; git diff --check
Not-tested: Running upstream:update against a different stable tag
Fold the lasting conversion, trust, editor-safety, and shortcut contracts into DESIGN.md and HANJA_DATABASE.md, update the documentation index, and remove completed phase plans now preserved in Git history.

Constraint: Live documentation should describe current contracts rather than completed implementation phases.
Rejected: Retain completed one-pagers as references | they duplicate the durable design and will drift independently.
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Put future lasting Hanja contracts in the live architecture document, not completed task plans.
Tested: No references remain to the deleted plan filenames; git diff --check
…ng history

Merge golbin/hop main through 608d54b, retaining the seven published Hanja commits and five focused follow-up commits. Adopt aligned v0.4.1 metadata while preserving dictionary build, verification, and test gates.

Constraint: Preserve published feature ancestry and the immutable upstream main target.
Rejected: Rebase onto upstream main | it rewrites published commits and requires a force push.
Rejected: Cherry-pick the upstream range | it loses merge ancestry and complicates later upstream synchronization.
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep package version 0.4.1 and all dictionary scripts and build or test gates after future upstream merges.
Related: 608d54b
Tested: 29 upstream tests; 7 dictionary tests; 296 Studio tests; pnpm run build:studio; pnpm upstream:verify; git diff --check
Not-tested: Desktop cargo tests and clippy are host-blocked by missing Linux GTK, GLib, Cairo, and WebKit pkg-config packages; GitHub Actions release matrix, signing, notarization, and installed-package smoke tests
…ries

Close the final pre-push review gaps by invalidating stale conversion runs, holding editor input before document replacement, preserving undo and redo entries for recovered preflight failures, and making the bundled Hanja notice tamper-evident and reachable from Product Info. Keep older WebKit compatibility and the upstream private API baseline explicit.

Constraint: Preserve published branch history, HOP-owned upstream boundaries, offline dictionary behavior, and macOS 12 support.
Rejected: Rewrite the seven published branch commits | normal follow-up commits preserve collaborator history.
Rejected: Trust a bundled notice path without a digest | redistribution terms must remain coupled to reviewed bytes.
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep document generation, focus ownership, notice manifest trust, and upstream private-input baselines synchronized when changing Hanja conversion.
Tested: pnpm run test:upstream; pnpm run test:dictionary; pnpm run test:studio; pnpm upstream:verify; pnpm run build:studio; Playwright 8-scenario Hanja and Product Info QA; Windows x86_64-pc-windows-gnu debug cross-build
Not-tested: Native macOS or Windows installed-app keyboard smoke; Linux desktop Rust tests and clippy blocked by missing GTK, GLib, and WebKit pkg-config libraries
Scope the text glyph positioning to the toolbar so menu rows retain upstream absolute icon layout. Add a viewport-height fallback and a baseline focus selector that remain effective on the oldest supported macOS WebKit, with CSS contract and live browser regressions.

Constraint: The desktop deployment target remains macOS 12.0, whose bundled WebKit predates dynamic viewport units and focus-visible support.
Rejected: Raise the macOS deployment target | compatible CSS fallbacks preserve the existing support contract without reducing coverage.
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Preserve legacy-compatible CSS before progressive WebKit declarations and keep shared icon positioning scoped to each host surface.
Tested: focused Studio UI tests 31/31; full Studio tests 319/319; TypeScript noEmit; pnpm run build:studio; Playwright 9-scenario Hanja, menu, focus, and Product Info QA
Not-tested: Physical macOS 12.0 WKWebView and native Windows installed-app smoke

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ee5a8715fd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}

override loadDocument(data: Uint8Array, fileName?: string): DocumentInfo {
this.prepareDocumentReplacement();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore the current editor when document parsing fails

When an invalid or unsupported document makes super.loadDocument throw, prepareDocumentReplacement() has already invoked the callback in main.ts that deactivates the input handler and disables the toolbar. The loadFile error path only reports the failure, so the previously open document remains displayed but cannot be edited afterward. Deactivate the old editor only after a successful load, or reactivate it when loading fails.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant