Skip to content

Autofill definition toggle prompt#3253

Draft
handeyeco wants to merge 2 commits intomainfrom
LEMS-3560/autofill-definition
Draft

Autofill definition toggle prompt#3253
handeyeco wants to merge 2 commits intomainfrom
LEMS-3560/autofill-definition

Conversation

@handeyeco
Copy link
Contributor

@handeyeco handeyeco commented Feb 13, 2026

Summary:

This adds a new API to widget editors that allows them to pre-populate widget options based on the context it's being added in.

Right now the only context is: what text is currently selected?

Right now the only widget behavior is: is text is selected when adding a Definition widget, use that text as the togglePrompt.

However this was built to facilitate future requests if the need arises.

Issue: LEMS-3560

Additional ideas:

  • Write a ticket to remove static defaultProps: DefinitionDefaultWidgetOptions = definitionLogic.defaultWidgetOptions; stuff? All things should be going through the parser which should add defaults.
  • Write a ticket to add getStartWidgetOptions to all widget editors?
  • Detach getStartWidgetOptions from the widget editor? We could use an editor registry instead.
  • Now that we have the parser, do we still need:
    • getDefaultWidgetOptions
    • applyDefaultsToWidget and applyDefaultsToWidgets
    • Renderer._getInitialWidgetState
  • const plotterDefaults = CoreWidgetRegistry.getDefaultWidgetOptions("plotter"); could be refactored better.

Test plan:

  1. Add text content to the question
  2. Select some of the text
  3. Add a definition widget
  4. The text should be removed from the content
  5. The text should be added to "Word to be defined" in definition widget options
Screen.Recording.2026-02-13.at.2.41.45.PM.mov

@handeyeco handeyeco self-assigned this Feb 13, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 13, 2026

🗄️ Schema Change: No Changes ✅

@github-actions
Copy link
Contributor

github-actions bot commented Feb 13, 2026

🛠️ Item Splitting: No Changes ✅

@github-actions
Copy link
Contributor

github-actions bot commented Feb 13, 2026

Size Change: +110 B (+0.02%)

Total Size: 484 kB

Filename Size Change
packages/perseus-editor/dist/es/index.js 99.3 kB +110 B (+0.11%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 20.8 kB
packages/keypad-context/dist/es/index.js 1 kB
packages/kmath/dist/es/index.js 5.98 kB
packages/math-input/dist/es/index.js 98.5 kB
packages/math-input/dist/es/strings.js 1.61 kB
packages/perseus-core/dist/es/index.item-splitting.js 11.8 kB
packages/perseus-core/dist/es/index.js 24.8 kB
packages/perseus-linter/dist/es/index.js 8.83 kB
packages/perseus-score/dist/es/index.js 9.26 kB
packages/perseus-utils/dist/es/index.js 403 B
packages/perseus/dist/es/index.js 186 kB
packages/perseus/dist/es/strings.js 7.44 kB
packages/pure-markdown/dist/es/index.js 1.39 kB
packages/simple-markdown/dist/es/index.js 6.71 kB

compressed-size-action

@github-actions
Copy link
Contributor

github-actions bot commented Feb 13, 2026

npm Snapshot: Published

Good news!! We've packaged up the latest commit from this PR (58608da) and published it to npm. You
can install it using the tag PR3253.

Example:

pnpm add @khanacademy/perseus@PR3253

If you are working in Khan Academy's frontend, you can run the below command.

./dev/tools/bump_perseus_version.ts -t PR3253

If you are working in Khan Academy's webapp, you can run the below command.

./dev/tools/bump_perseus_version.js -t PR3253

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant