Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring Mermaid diagram priority higher than heading's anchor #6299

Merged
merged 1 commit into from Dec 19, 2023

Conversation

david50407
Copy link
Contributor

Motivation

If we insert Mermaid diagram right before heading, anchor of the heading will be inserted between code block and mermaid diagram preview, this will cause diagram won't hide when section is folded.

Representation Steps

  1. Create a code block with Mermaid diagram
  2. Create any level of heading right after the diagram

Expect behavior

  • Mermaid diagram works properly

Actual behavior

  • Mermaid diagram still show but with some bugs as described above

Root cause

image

As you can see in the screenshot, anchor of the heading has been inserted between the code block and the diagram, this will break css sibling tricks here:

https://github.com/outline/outline/blob/main/shared/editor/components/Styles.ts#L1496C1-L1496C43

That's because heading node will insert a invisible anchor right before the heading with priority (side: -1) higher than Mermaid diagram (side: 0 (which is default))

https://github.com/outline/outline/blob/main/shared/editor/nodes/Heading.ts#L252C15-L252C23

https://github.com/outline/outline/blob/main/shared/editor/extensions/Mermaid.ts#L196C1-L199C8

About the priority, see the document of ProseMirror:

https://prosemirror.net/docs/ref/#view.Decoration%5Ewidget%5Espec.side

After the Fix

In this patch, I've raise the priority of Mermaid diagram to higher (side: -10) than anchor of headings, and the diagram will stick with the code block properly 🎉

image

Comments

Feel free to discuss if the solution is not properly (stupidly raise diagram's priority)

@auto-assign auto-assign bot requested a review from tommoor December 18, 2023 02:51
@CLAassistant
Copy link

CLAassistant commented Dec 18, 2023

CLA assistant check
All committers have signed the CLA.

@tommoor
Copy link
Member

tommoor commented Dec 19, 2023

This seems very reasonable and well explained, thanks for the patch

Copy link
Member

@tommoor tommoor left a comment

Choose a reason for hiding this comment

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

This also fixes clicking on the diagram to focus the source code, which didn't work in this scenario either.

@tommoor tommoor merged commit d09a4f7 into outline:main Dec 19, 2023
9 checks passed
hamzaabamboo pushed a commit to hamzaabamboo/outline that referenced this pull request Jan 20, 2024
pull-sealing-club-ver bot pushed a commit to SealingClub/outline that referenced this pull request Feb 8, 2024
truecharts-admin added a commit to truecharts/charts that referenced this pull request Feb 21, 2024
…c3ed1 by renovate (#18428)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [outlinewiki/outline](https://togithub.com/outline/outline) | minor |
`0.74.0` -> `0.75.1` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>outline/outline (outlinewiki/outline)</summary>

###
[`v0.75.1`](https://togithub.com/outline/outline/releases/tag/v0.75.1)

[Compare
Source](https://togithub.com/outline/outline/compare/v0.75.0...v0.75.1)

#### What's Changed

##### Improvements

- Added flag `--no-migrate` to optionally suppress automatic migrations
on startup (the container will exit instead).
- Added option `OIDC_LOGOUT_URI` as optional post-logout redirect url by
[@&#8203;Shuttleu](https://togithub.com/Shuttleu) in
[outline/outline#6539
- Added option `OIDC_DISABLE_REDIRECT` to prevent automatic OIDC
redirect by [@&#8203;Shuttleu](https://togithub.com/Shuttleu) in
[outline/outline#6544
- `MAXIMUM_IMPORT_SIZE` was deprecated and split into
`FILE_STORAGE_IMPORT_MAX_SIZE` (for documents) and
`FILE_STORAGE_WORKSPACE_IMPORT_MAX_SIZE` (for workspace imports) in
[outline/outline#6566

##### Fixes

-   Fixed new paragraphs are lost in table cells imported from HTML
- Fixed an issue where tables with empty cells could fail to import from
HTML
- Fixed an issue where quoted search queries with colons could cause a
server error
-   Fixed regression in styling of search filter options
- Fixed an issue where error in OIDC login would result in infinite
redirect
- Hide image drag handles, empty captions, and selected outlines when
printing in
[outline/outline#6550
- Missing highlighted context on search results page in
[outline/outline#6549
- Error for self-host draw.io by
[@&#8203;TaoChan1005](https://togithub.com/TaoChan1005) in
[outline/outline#6554
- Propagate Enter key events in `SuggestionsMenu` allows pressing
`Enter` after typed url in embed input by
[@&#8203;superkelvint](https://togithub.com/superkelvint) in
[outline/outline#6556
- Do not load `opensearch.xml` from CDN, so it uses the correct
subdomain by [@&#8203;waf](https://togithub.com/waf) in
[outline/outline#6567
- `CMD+Z` now works now works when the editor component does not
technically have focus
- Served HTML `lang` attribute now reflects installation default
language

#### New Contributors

- [@&#8203;Shuttleu](https://togithub.com/Shuttleu) made their first
contribution in
[outline/outline#6539
- [@&#8203;TaoChan1005](https://togithub.com/TaoChan1005) made their
first contribution in
[outline/outline#6554
- [@&#8203;superkelvint](https://togithub.com/superkelvint) made their
first contribution in
[outline/outline#6556
- [@&#8203;waf](https://togithub.com/waf) made their first contribution
in
[outline/outline#6567

**Full Changelog**:
outline/outline@v0.75.0...v0.75.1

###
[`v0.75.0`](https://togithub.com/outline/outline/releases/tag/v0.75.0)

[Compare
Source](https://togithub.com/outline/outline/compare/v0.74.0...v0.75.0)

#### What's Changed

<img width="618" alt="image"
src="https://github.com/outline/outline/assets/380914/ff00680a-9e8a-46a4-94fa-48622d0fcc3c">

This release brings a rebuild of the internal permissions in order to
support inviting users to individual documents, this has been several
months work and involved a complete redesign of the `Share` menu on
documents. We have also worked to clarify public sharing and will be
bringing similar enhancements to permission management in collections
for the next release.

This month we also introduced [AI
Answers](https://www.getoutline.com/changelog/ai-answers) in
cloud-hosted Outline. This integration allows searched questions to be
answered directly from the contents of your knowledge base! We're
excited to make this available on the [business
license](https://www.getoutline.com/pricing) – If you'd like to upgrade
to a paid license to access this feature [please get in
touch](https://www.getoutline.com/contact).

##### Improvements

- Document title will now be automatically used when pasting internal
doc url in
[outline/outline#6352
- Embeds are now rendered within HTML and PDF exports in
[outline/outline#6290
- Added ability to include drafts in search results by
[@&#8203;apoorv-mishra](https://togithub.com/apoorv-mishra) in
[outline/outline#6335
-   Added 20+ new custom icons to use for collections
- Comments in the sidebar will now show the associated highlighted text
in the document
- Installations with a single OIDC auth-provider will auto-redirect on
login
- Retina images pasted into a document are now sized as they should be
viewed in
[outline/outline#6350
- Improved collection creation UI in
[outline/outline#6485
- You can now drag a document or collection into the "Starred" section
to star in the sidebar
-   It's now possible to replace a file attachment inline
- Automatically replace (--) with emdash by
[@&#8203;L11R](https://togithub.com/L11R) in
[outline/outline#6479
-   Added native keyboard shortcuts for Find+Replace functionality
-   Inline code now has a "Copy" action in the toolbar
- Added "Find and replace" option to menu on mobile in
[outline/outline#6368
- Added a security setting to allow users to send invites in
[outline/outline#6488
- Added [Camunda](https://camunda.com/) embed support in
[outline/outline#6457
-   Added support for [SmartSuite](https://app.smartsuite.com) embeds
- Added support for embedded images in Word documents exported from
Confluence in
[outline/outline#6361
-   Added a "Copy as Markdown", and "Copy as Link" actions to documents
- Invite user screen now displays which collections they will be granted
access to
- In-app notifications are now instant rather than delayed like emails
in
[outline/outline#6506
-   API: Added missing `integrations.info` endpoint
-   API: Added missing `comments.info` endpoint
-   And lots more I've probably forgotten…

##### Fixes

- Positioning of editing toolbar on mobile devices in
[outline/outline#6279
- Suspended users now receive the correct error message on attempted
login by [@&#8203;ruizehung](https://togithub.com/ruizehung) in
[outline/outline#6297
- Fixed an issue where Mermaid diagrams are not displayed correctly next
to headings by [@&#8203;david50407](https://togithub.com/david50407) in
[outline/outline#6299
- Fixed theme rendering of Mermaid diagrams by
[@&#8203;david50407](https://togithub.com/david50407) in
[outline/outline#6307
-   Fixed Airtable embeds not working with latest url format
- Fixed an issue where Firefox would not behave correctly when resizing
a video
-   Fixed a server error when search term contains double single quotes
- Fixed an issue where pasted links from HTML could result in a double
underline formatting
- Fixed a race condition that could result in corrupt structure in the
collection sidebar
- Fixed an issue where settings could not be saved until an avatar was
uploaded
- Fixed an issue that preventing unpublishing documents with archived
children
-   It is now possible to use parentheses before an @&#8203;mention
- Fix flash on render of newly created comments
[outline/outline#6322
- Database relationships are now cleaned up correctly when a user is
deleted in
[outline/outline#6343
- Add notifications for document and collection access in
[outline/outline#6460
- Updates to user model are now synced between clients in
[outline/outline#6490
- Improved resiliency of importer in
[outline/outline#6519,
[outline/outline#6273
- It is no longer possible to duplicate comment marks through copy/paste
of text
-   Pasting a markdown table will now always trigger markdown parsing

#### New Contributors

- [@&#8203;ruizehung](https://togithub.com/ruizehung) made their first
contribution in
[outline/outline#6297
- [@&#8203;david50407](https://togithub.com/david50407) made their first
contribution in
[outline/outline#6299
- [@&#8203;L11R](https://togithub.com/L11R) made their first
contribution in
[outline/outline#6479

**Full Changelog**:
outline/outline@v0.74.0...v0.75.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 10pm on monday" in timezone
Europe/Amsterdam, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xOTguMyIsInVwZGF0ZWRJblZlciI6IjM3LjIwMy4zIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIn0=-->
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.

None yet

3 participants