getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.32k stars 168 forks source link

Writer Field: Email link not highlighted after refresh #6115

Open AnnikaGruca-JUNO opened 10 months ago

AnnikaGruca-JUNO commented 10 months ago

Description

Email links are not highlighted in the writer field if "email" is not listed as a writer mark and an email link is inserted via the link mark (in the link dialog).

To reproduce

  1. Have a writer field with marks:
    fields:
    text:
    type: writer
    nodes: false
    marks:
      - link
  2. Select a word and apply the "link" mark to it, to open the link dialog
  3. Choose the link type "Email" and enter a email address
  4. Save the changes (link is still visible)
  5. Reload the page – now the link isn't displayed anymore

If you now add the mark email to your writer field, the link is visible:

fields:
  text:
    type: writer
    nodes: false
    marks:
      - link
+     - email

Your setup

Kirby Version
4.0.2

gbdesign2023 commented 10 months ago

The description says: "Sets the allowed HTML formats.". This is therefore not an error, as you explicitly only allow URLs with "marks: - link". If you omit the "marks" field properties, email links are highlighted again. However, you could declare it as an error that other link types can still be selected:

fields:
  text:
    type: writer
    nodes: false
    marks:
      - link
Bildschirmfoto 2024-01-03 um 18 03 19
distantnative commented 10 months ago

Indeed the result is kind of expected based on how the writer and underlying ProseMirror works.

However, I am wondering if with the new link field we really need the separate email mark and dialog. I think we could rather merge it to just the link mark/dialog (and then add the email link highlighting to the link mark too).

@bastianallgeier opinions?

bastianallgeier commented 10 months ago

I agree that we could merge it

silllli commented 9 months ago

I would vote for making the link types customizable though (just like the headings), for instance:

fields:
  text:
    type: writer
    nodes: false
    marks:
      - link
    links:
      - email
      - tel
thomasjonas commented 5 months ago

I ran into the same issue. Took me quite a while to figure out what was wrong. If I am able to create mailto links, and I see them in the editor when I press save, it is quite confusing to see them go missing when I come back to the page later. My first thought was that I might have forgotten to press save. I think making the link types customizable is a good idea.

jensscherbl commented 4 months ago

I think the much bigger problem here (compared to just a display bug) is that if something else on the page changes and the page is saved again, the content for the writer field is overwritten and the link is dropped as well. Meaning Kirby accidentally alters your content and actually loses your data.