Skip to content

Allow async JavaScript evaluation#1276

Merged
cyanzhong merged 1 commit intomainfrom
develop
Mar 12, 2026
Merged

Allow async JavaScript evaluation#1276
cyanzhong merged 1 commit intomainfrom
develop

Conversation

@cyanzhong
Copy link
Contributor

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds an option for JavaScript evaluation to run via WebKit’s async JavaScript mechanism (Promise-based), exposing it both to the Shortcuts intent and AppleScript scripting interface.

Changes:

  • Add a callAsync / callAsyncJavaScript boolean parameter to opt into Promise-based JS evaluation.
  • Route JS evaluation through a new WKWebView.evaluateJavaScript(_:callAsync:completionHandler:) helper that uses callAsyncJavaScript when enabled.
  • Update the scripting definition (.sdef) and string catalog entries to reflect the new parameter and related UI strings.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
MarkEditMac/Sources/Shortcuts/Intents/EvaluateJavaScriptIntent.swift Adds callAsync intent parameter and uses the new WKWebView helper overload.
MarkEditMac/Sources/Scripting/EditorDocument+Scripting.swift Adds AppleScript argument parsing for callAsyncJavaScript and passes it into JS evaluation.
MarkEditMac/Resources/MarkEdit.sdef Adds callAsyncJavaScript boolean parameter to the scripting dictionary.
MarkEditMac/Resources/Localizable.xcstrings Adds localizations for the new parameter title/description and updates related extracted strings.
MarkEditKit/Sources/Extensions/WKWebView+Extension.swift Introduces the callAsync-aware JS evaluation wrapper using callAsyncJavaScript.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@cyanzhong cyanzhong merged commit ab56d13 into main Mar 12, 2026
5 checks passed
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.

2 participants