Skip to content

Markers - Custom markers embedded in the document #69

@adrian-moisa

Description

@adrian-moisa

Markers are highlights that are permanently embedded in the document. Meaning the delta document uses a dedicated attribute for markers. Highlights are defined without touching the delta document and have a short life span. They can be used to highlight portions of the document. Markers can be triggered in several ways, either by hovering them, or by invoking a method. Markers can belong to a set. Multiple marker sets can be defined, each one with unique colors, callbacks and settings.


Temporary Notes:

Markers

V - Markers folder

  • Hide markers (all, set, individual) --> BRAINSTORM
  • New attribute
  • Generic API with
    • Type, id, color, callback,
  • Preserve at copy paste
  • Toolbar Dropdown (Lists marker sets)
  • Testing
  • Docs

Markers

  • Capture markers so far for YT, Capture highlights
  • Update docs on the markers .md
  • Highlights demo, Select text, add highlight
  • Use setHighlights
  • Highlights tests
  • Highlights controller methods
  • Study
    V - How TextLine works,
    V - How Styles are applied to Text spans,
    V - How embeds are rendered
    V - How attributes are converted to nodes
    • Why check for only inline or only ignored? How to add custom attributed without changing core? Data resolver?

Highlights

  • setHighlights()
    • Trigger update
    • Checks doc boundaries
  • resetHighlights()
    • FIx highlights hover

Study

  • Link text spans have gesture recognizers. We can use them for the marker attribute.
  • lineLeadingWidget - Maybe this is how I can do the heading counters
  • Attributes seem to be a plain old map of keys and values. So anything could be added there.
    • Multiple styles are allowed per attributes
    • Unknown styles are rejected
  • We need to define new attributes to be recognised
  • StyleM converts attributes to models
    • attr = AttributeM.fromKeyValue(key, value);
    • looks for the attribute in the registry
    • So it appears we can only use known attributes
      • It appears to be creating an AttributeM but with AttributeM(key, AttributeScope.IGNORE, value)
  • Can we define new attributed from outside of the lib?
    • So far I can see they end up in the ignore scope and if there's a mix of inline or ignore then the editor fails, but there's no explanation why.
  • Most likely I need to define data decoders for the custom data types (embeds)
  • Useful with embedded blocks. typedef DataDecoder
  • Many attributes seem to have a value although there's no useful info in it. For example bold has value true... ok... and what happens with value false?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions