Skip to content

Added 'Mark Text' menu for Linux and Windows - #59

Merged
Jocs merged 2 commits into
marktext:masterfrom
fxha:ApplicationMenu
Mar 23, 2018
Merged

Jocs merged 2 commits into
marktext:masterfrom
fxha:ApplicationMenu

Conversation

@fxha

@fxha fxha commented Mar 22, 2018 •

Copy link
Copy Markdown
Contributor
Q A
Fixed tickets #56
License MIT

Description

Added "Mark Text" menu entries to File and Help menu on Linux and Windows.

I added .fg-color-dark to dark/light.css because I can't find a alternative solution to change text color based on the theme. I'm not a frontend guy, so feel free to change the UI.

  • Add 'Mark Text' menu for Linux and Windows
  • Create vue about dialog

mt_about_1

mt_about_2

mt_cm_1

mt_cm_2

@SuperSandro2000

Copy link
Copy Markdown
Contributor

It may be worth not hardcoding key combinations to make it easier to change them later.

@fxha fxha changed the title [WIP] Added 'Mark Text' menu for Linux and Windows Added 'Mark Text' menu for Linux and Windows Mar 22, 2018
Comment thread src/main/menus/file.js Outdated
}
}, {
type: 'separator',
visible: process.platform !== 'darwin'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can store process.platform !== 'darwin' in a variable. So follow the BEST PRACTICE DRY!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Why should I use a variable - process.platform itself is a variable? Otherwise, where should the variable be stored?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

put the variable in the top of the file, but bellow the import statements.

const notOsx = process.platform !== 'darwin'

you can change the name of this variable, depends on you.

Comment thread src/main/menus/help.js Outdated
}
}, {
type: 'separator',
visible: process.platform !== 'darwin'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Follow the BEST PRACTICE DRY.

Comment thread src/main/menus/marktext.js Outdated
label: 'Mark Text',
submenu: [{
label: 'About Mark Text',
role: 'about'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use showAboutDialog ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This menu is only for OSX, so should we use the linux/windows about dialog?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So I suggest use linux/windows about dialog,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Currently the "native" dialog is shown on OSX and the "custom" about dialog on linux/windows

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I suggest all system use the custom about dialog

Comment thread src/main/menus/file.js
label: 'Quit',
accelerator: 'Ctrl+Q',
visible: process.platform !== 'darwin',
click: app.quit

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this work in windows?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes tested on linux and windows

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ok

Comment thread src/renderer/components/about/index.vue Outdated
return {
showAboutDialog: false,
name: 'Mark Text',
version: remote.app.getVersion(),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you put version in store, maybe other components will use this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

How do i access the store? Did you mean state?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yes, use mapState in computed state, You can refer other files in this project.

Comment thread src/renderer/components/about/index.vue Outdated
name: 'Mark Text',
version: remote.app.getVersion(),
versionPrefix: 'v',
markTextLogo: require('../../../../static/logo-small.png')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

put logo-small.png in the path src/render/assets/images/logo-small.png, and don't need to require or import, just write it to the src of img tag.

BTY, the size of logo-small.png is too big, I think 150 * 150 px is enough, can you resize it, and rename it to logo.png

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The current size is 128x128x, should it be changed anyway?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I mean the nature size of the image, not the width and height which we set to the style.

])
},
created () {
bus.$on('aboutDialog', this.showDialog)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

add bus.$off('aboutDialog', this.showDialog) in the hook of beforeDestroy

Comment thread src/renderer/store/editor.js Outdated
},

LISTEN_FOR_ABOUT_DIALOG ({ commit }) {
ipcRenderer.on('AGANI::aboutDialog', e => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

change the event name to AGANI::about-dialog

Comment thread src/main/actions/help.js Outdated
@@ -0,0 +1,3 @@
export const showAboutDialog = win => {
win.webContents.send('AGANI::aboutDialog')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

rename event AGANI::aboutDialog to AGANI::about-dialog

@fxha
fxha force-pushed the ApplicationMenu branch from 0052d9e to a4f6a1f Compare March 23, 2018 09:35
@fxha

fxha commented Mar 23, 2018

Copy link
Copy Markdown
Contributor Author

All issues are fixed. Ready to merge?

@Jocs
Jocs merged commit e3340e1 into marktext:master Mar 23, 2018
@Jocs

Jocs commented Mar 23, 2018

Copy link
Copy Markdown
Member

@fxha great!

@fxha
fxha deleted the ApplicationMenu branch March 24, 2018 10:52
Jocs added a commit that referenced this pull request Jun 21, 2026
marked 17+ changed tokenization in ways muya's parser layer must absorb:

- Task lists: marked now emits a `checkbox` token and keeps the literal
  "[ ] " / "[x] " marker in the item content (in a paragraph's `text` for
  loose lists). muya renders the marker from the task-list-item `checked`
  meta, so `compatibleTaskList` now strips it from both tight and loose items
  — otherwise every md -> state -> md round-trip duplicated the checkbox.
- Indented code: the `code` token text now carries a trailing newline (fenced
  does not); markdownToState strips it so indented blocks round-trip.
- Setext headings: conformance improved — CommonMark #84/#89 and GFM #54/#59
  now pass and are removed from expected-failures.json.

Verified: muya 143 unit + 4 conformance suites (compliance up), desktop 17
unit, build:unpack OK.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Jocs added a commit that referenced this pull request Jun 21, 2026
…4597)

* chore(deps): refresh all packages to latest within current majors

Routine `pnpm update -r` across the workspace — bumps every dependency to its
latest release within the existing major (no breaking-major changes) and
updates the package.json caret floors. Highlights:

- desktop: electron 42.1.0->42.4.1, electron-builder 26.8.1->26.15.3,
  axios 1.16.1->1.18.0, element-plus 2.14.0->2.14.2, vue 3.5.34->3.5.38,
  vue-i18n 11.4.2->11.4.6, electron-updater 6.8.3->6.8.9, vitest 4.1.6->4.1.9
- muya/muyajs: snabbdom 3.6.3->3.6.4, fuse.js 7.3.0->7.4.2
- tooling: prettier 3.8.4, tsx 4.22.4, @playwright/test 1.61.0,
  typescript-eslint 8.61.1, eslint-plugin-* bumps
- website: react 19.2.7, wrangler 4.103.0, @axe-core/playwright 4.11.3

@types/node kept on the v22 line to match the Node 22 runtime. Shared deps
now align across packages except the cross-major splits (eslint/typescript/
vite) handled in following commits.

Verified: lint 0 errors, typecheck clean, muya 143 unit + 4 conformance,
desktop 17 unit, build:unpack OK.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* chore(deps): upgrade desktop to typescript 6 + vue-tsc 3

Aligns desktop's TypeScript with muya (already on 6). vue-tsc 2->3
(vue-language-tools 3); typescript-eslint 8.61 supports TS <6.1 and vue-tsc 3
peers TS >=5, so the desktop type-check stack moves cleanly.

Verified: `vue-tsc --noEmit` passes on desktop. TypeScript is type-check-only
tooling here (esbuild drives build + vitest), so runtime/build are unaffected.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* chore(deps): upgrade katex to ^0.17.0 across muya/muyajs/desktop

Bumps the math renderer to 0.17 and normalizes muya's pin from an exact
`0.16.47` to `^0.17.0`, so the declared version is consistent across the three
packages. mermaid + micromark-extension-math keep their own transitive
katex 0.16.x (forcing those to 0.17 risks their math rendering).

Verified: muya 143 unit + 4 conformance, desktop 17 unit, build:unpack OK.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* chore(deps): upgrade plist to ^5.0.0 (desktop)

plist is used in a single place: parsing the macOS NSFilenamesPboardType
clipboard payload via `plist.parse()` (main/ipc/shell.ts). The parse API is
stable across the major bump — desktop type-check passes against plist 5's
types and build:unpack is clean. Transitive plist 3.x pulled by other tooling
is left as-is.

Verified: desktop typecheck clean, build:unpack OK.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* chore(deps): upgrade vue-router to ^5.1.0 (desktop)

Desktop's router uses only modern APIs (createRouter + createWebHashHistory,
RouteRecordRaw, named/children/redirect routes, <router-view>) — none of the
deprecated APIs v5 removes. v5's only required peer is vue ^3.5.34 (satisfied);
pinia / @pinia/colada / vite peers are optional.

Verified: desktop typecheck clean, 17 unit suites pass, build:unpack OK.
Real-app routing is additionally exercised by the e2e / run-on-pr-head CI jobs.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* chore(deps): upgrade marked to ^18.0.5 (muya parser)

marked 17+ changed tokenization in ways muya's parser layer must absorb:

- Task lists: marked now emits a `checkbox` token and keeps the literal
  "[ ] " / "[x] " marker in the item content (in a paragraph's `text` for
  loose lists). muya renders the marker from the task-list-item `checked`
  meta, so `compatibleTaskList` now strips it from both tight and loose items
  — otherwise every md -> state -> md round-trip duplicated the checkbox.
- Indented code: the `code` token text now carries a trailing newline (fenced
  does not); markdownToState strips it so indented blocks round-trip.
- Setext headings: conformance improved — CommonMark #84/#89 and GFM #54/#59
  now pass and are removed from expected-failures.json.

Verified: muya 143 unit + 4 conformance suites (compliance up), desktop 17
unit, build:unpack OK.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* chore(deps): prune now-redundant pnpm overrides after upgrades

Re-checked every security override against the upgraded tree. The dependency
refresh now resolves patched versions natively, so 7 of the 8 overrides are
redundant and removed:

  @babel/core (7.29.6), form-data (4.0.6), js-yaml (4.2.0), tar (7.5.16),
  tmp (0.2.6), undici (7.28.0), ws (8.21.0)

Kept:
  - esbuild >=0.27.0 <0.28.1 -> 0.28.1: vite 7.3.5 (desktop, pinned by
    electron-vite which peers vite <=7) still pulls the vulnerable esbuild
    0.27.7; this bridges it until electron-vite supports vite 8.
  - postcss 8.5.15: pre-existing (since #4314), pins to current latest 8.x.

Verified: lockfile keeps every previously-flagged package at a patched
version; build:unpack OK.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* chore(deps): align muya mermaid specifier to caret

muya pinned mermaid to an exact "11.15.0" while desktop/muyajs use "^11.15.0".
Normalize to "^11.15.0" so the declared version is consistent across packages
(resolves to the same 11.15.0).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(deps): defer vue-router 5 — keep ^4.6.4

vue-router 5 passed typecheck/unit/build but broke the desktop app launch in
e2e: every suite's beforeAll timed out because the renderer never reached
ready (renderer errors captured by the e2e helper). Unit tests don't mount the
full app + router, so the runtime regression only surfaced in e2e.

Revert to ^4.6.4 (latest 4.x, known-good). vue-router 5 needs a dedicated
migration PR with e2e verification, like codemirror 6 / website next 16.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(deps): make plist 5 work in the CJS main process

plist 5 ships ESM-only with named exports and no CJS `exports` entry, so the
externalized main-process `require('plist')` threw
ERR_PACKAGE_PATH_NOT_EXPORTED at startup — the app never launched, which failed
every desktop e2e suite (beforeAll launch timeout). The earlier vue-router
revert was a red herring; muya's own e2e passed, ruling out the engine.

Fix: exclude plist from externalization so electron-vite bundles it as CommonJS
(same pattern as electron-store), and switch shell.ts to a namespace import
(`import * as plist`) since plist 5 dropped its default export.

Verified: build:unpack bundles plist inline (no runtime require('plist')),
typecheck clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(deps): pin electron to ~42.1.0 (42.4 breaks Electron teardown on xvfb CI)

Root-caused the desktop e2e teardown cascade. app.close() hangs cumulatively
across the workers:1 sequential run on Linux/xvfb: each Electron app leaves
child processes that don't terminate promptly, accumulating until close — then
later launches — fail (~16 "Worker teardown timeout" + did-not-run). It does
NOT reproduce on macOS (113/114 local), and is not font-list / vue-router /
@playwright/test / electron-updater (each eliminated with evidence: e.g.
font-list 2.0.2 leaks the same handle; reverting playwright/vue-router didn't
help). The only changed process-runtime dependency is electron 42.1->42.4
(clean-CI #4596 ran 42.1.0). Pin to ~42.1.0; revisit 42.x once its
headless-Linux child-process teardown is stable.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* test(muya): run formatToggle html_tag-mount tests under jsdom

Split the two "mounts the html_tag into the live editor DOM" cases (<u>/<mark>)
out of formatToggle.spec.ts into formatToggleHtmlTagMount.spec.ts (jsdom). They
route a live element through DOMPurify, which strips all elements under
happy-dom on dompurify 3.4.8+ (its namespace hardening isn't satisfied there).
The rest of formatToggle.spec.ts stays on happy-dom because its selection /
picker assertions rely on happy-dom's selection behavior. Consistent with the
other DOMPurify-dependent specs moved to jsdom in the dompurify bump.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
thimbleberrysystems pushed a commit to thimbleberrysystems/WordBird that referenced this pull request Jun 21, 2026
* Add 'Mark Text' menu for Linux and Windows

* Add about dialog for linux and windows
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.

3 participants