Skip to content

[XWI-142] Enable wiki macros in more editors - #24480

Open
shiroginne wants to merge 3 commits into
devfrom
feature/xwi-142-enable-wiki-macros-in-more-editors
Open

[XWI-142] Enable wiki macros in more editors#24480
shiroginne wants to merge 3 commits into
devfrom
feature/xwi-142-enable-wiki-macros-in-more-editors

Conversation

@shiroginne

Copy link
Copy Markdown
Contributor

Ticket

XWI-142

What are you trying to accomplish?

Centralise CKEditor wiki macro.
Add the wiki macro to CKEditor in many places.
The places are:

  • comments (activity)
  • custom fields (long text)
  • custom fields help text
  • meetings:
    • description
    • outcomes
    • agenda item

Screenshots

Screenshot 2026-07-28 at 15 45 04

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

Move the `wikisAvailable` check into the central CKEditor macro resolver and add a `wiki` macro preset, so any editor can opt in with a one-liner instead of repeating the logic.
The places are:
- comments (activity)
- custom fields (long text)
- custom fields help text
- meetings:
  - description
  - outcomes
  - agenda item
@shiroginne shiroginne self-assigned this Jul 28, 2026
@shiroginne
shiroginne requested a review from a team July 28, 2026 13:45
@github-actions

Copy link
Copy Markdown

Warning

Flaky specs

  • rspec ./modules/overviews/spec/features/managing_dashboard_page_spec.rb[1:1:1]
🤖 Ask Copilot to investigate

Copy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer.

@copilot The following spec(s) are flaky in CI (first seen on PR #24480, linked for reference only):

- `rspec ./modules/overviews/spec/features/managing_dashboard_page_spec.rb[1:1:1]`

Treat this as a standalone task, unrelated to PR #24480. Create a new branch from origin/dev and open a new pull request targeting dev — do not stack it on PR #24480 or reuse that branch.

Follow the playbook in docs/development/testing/handling-flaky-tests/README.md to find the root cause and fix the underlying race — do not skip, delete, or weaken the spec to make it pass; disabling is a last resort per the playbook, and only with a bug ticket. Verify the fix by running the spec(s) repeatedly (e.g. `script/bulk_run_rspec --run-count 10`).

If you cannot reproduce the flake or are not confident in a fix after reasonable investigation, do not fabricate a change or skip the spec to force CI green. Instead, leave the pull request in draft and document what you tried, the suspected cause, and any leads in its description, then assign @shiroginne to take over.

Once the fix is verified, title the PR after the spec(s) it fixes, and use the PR description to explain the root cause, how the change resolves it, and the before/after results. Label the PR `flaky-spec`, assign @shiroginne, and request a review from @shiroginne.
On every commit, set @shiroginne as the sole co-author with a `Co-authored-by:` trailer (use their GitHub no-reply email so it links to their account), so it is traceable who dispatched the fix.

@NobodysNightmare NobodysNightmare left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall this looks like a valid extension of the existing ICKEditorMacroType, which seems to have been intended exactly like this.

I can't say that I am a huge fan of this type and if anything, I'd urge to strengthen documentation around it and stricten type definitions up where-ever possible.

if (resolved === 'none') {
return false;
}
if (resolved === 'resource') {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

❓ Looking at the diff, this wasn't handled before as well, but do you know what we do for full?


// Expand macro tokens and add/withhold the wiki macros based on `wikisAvailable`.
// `false`/`'none'` stay macro-free, keeping custom fields and read-only editors untouched.
private resolveMacros(macros:ICKEditorMacroType|undefined):ICKEditorMacroType|undefined {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess the return type was opened to ICKEditorMacroType|undefined, because the input type for macros was opened to |undefined as well.

Couldn't we expand the first check to

    if (!resolved || resolved === 'none') {
      return false;
    }

This would at least make our method guarantee to return a ICKEditorMacroType, regardless of input as far as I can tell.


export type ICKEditorType = 'full'|'constrained';
export type ICKEditorMacroType = 'none'|'resource'|'full'|boolean|string[];
export type ICKEditorMacroType = 'none'|'resource'|'full'|'wiki'|boolean|string[];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is such a cursed type definition. One of four string, a boolean or a string array 🤯

Should we somewhere (here or in resolveMacros) explain what each of those strings is supposed to mean?

My current take:

  • none: nothing
  • resource: the resource stuff + wiki stuff
  • full: I have no clue... nothing?!?
  • wiki: wiki stuff only


// Expand macro tokens and add/withhold the wiki macros based on `wikisAvailable`.
// `false`/`'none'` stay macro-free, keeping custom fields and read-only editors untouched.
private resolveMacros(macros:ICKEditorMacroType|undefined):ICKEditorMacroType|undefined {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am even wondering whether we should split up the input type and the output type. As far as I can tell CKEditor will only digest false or a string array. The addition of single strings seems to be an extension of ours.

So maybe the input type should be what ICKEditorMacroType currently is, while the return type should be the equivalent of what CKEditor would accept? I.e. not all the simple strings?

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants