remove staticWithOverlappingHighlights

This commit is contained in:
Tessa Kelly 2023-04-05 09:54:52 -06:00
parent 7fd8d829b9
commit 513056fe18
2 changed files with 3 additions and 53 deletions

View File

@ -268,33 +268,6 @@ example =
, highlightables = Highlightable.fromMarkdown "Select your [favorite phrase]() in **your** writing."
}
}
, { viewName = "staticWithOverlappingHighlights"
, tool = "buildMarkerWithoutRounding"
, highlightable = "init"
, description = "Multiple kinds of highlights with overlaps."
, example =
Highlighter.staticWithOverlappingHighlights
{ id = "example-6"
, highlightables =
[ ( "Sphinx", [ inlineCommentMarker "Comment 1", inlineCommentMarker "Comment 2" ] )
, ( "of", [ inlineCommentMarker "Comment 2" ] )
, ( "black quartz,", [ inlineCommentMarker "Comment 3", inlineCommentMarker "Comment 2" ] )
, ( "judge", [ inlineCommentMarker "Comment 3", inlineCommentMarker "Comment 2" ] )
, ( "my", [ inlineCommentMarker "Comment 2" ] )
, ( "vow.", [] )
]
|> List.intersperse ( " ", [] )
|> List.indexedMap
(\i ( word, marker ) ->
if String.Extra.isBlank word then
Highlightable.initStatic marker i word
else
Highlightable.initInteractive marker i word
)
|> Highlightable.joinAdjacentInteractiveHighlights Sort.alphabetical
}
}
]
]
, categories = [ Instructional ]

View File

@ -3,7 +3,7 @@ module Nri.Ui.Highlighter.V4 exposing
, init, update
, view, static, staticWithTags
, viewMarkdown, staticMarkdown, staticMarkdownWithTags
, viewWithOverlappingHighlights, staticWithOverlappingHighlights
, viewWithOverlappingHighlights
, Intent(..), hasChanged, HasChanged(..)
, removeHighlights
, clickedHighlightable, hoveredHighlightable
@ -13,6 +13,7 @@ module Nri.Ui.Highlighter.V4 exposing
{-| Changes from V3:
- Highlighter.update now takes a sorter for the markers
- removes staticWithOverlappingHighlights
Highlighter provides a view/model/update to display a view to highlight text and show marks.
@ -28,7 +29,7 @@ Highlighter provides a view/model/update to display a view to highlight text and
@docs view, static, staticWithTags
@docs viewMarkdown, staticMarkdown, staticMarkdownWithTags
@docs viewWithOverlappingHighlights, staticWithOverlappingHighlights
@docs viewWithOverlappingHighlights
## Intents
@ -723,30 +724,6 @@ viewWithOverlappingHighlights model =
}
{-| -}
staticWithOverlappingHighlights : { config | id : String, highlightables : List (Highlightable marker) } -> Html msg
staticWithOverlappingHighlights config =
view_
{ showTagsInline = False
, maybeTool = Nothing
, hoveringIndex = Nothing
, hintingIndices = Nothing
, overlaps = True
, viewSegment =
viewHighlightableSegment
{ interactiveHighlighterId = Nothing
, focusIndex = Nothing
, eventListeners = []
, maybeTool = Nothing
, hoveringIndex = Nothing
, hintingIndices = Nothing
, renderMarkdown = False
}
, id = config.id
, highlightables = config.highlightables
}
{-| Same as `view`, but will render strings like "_blah_" inside of emphasis tags.
WARNING: the version of markdown used here is extremely limited, as the highlighter content needs to be entirely in-line content. Lists & other block-level elements will _not_ render as they usually would!