diff --git a/src/pyj/range_utils.pyj b/src/pyj/range_utils.pyj index ad25f5e2df..aa8a8b653e 100644 --- a/src/pyj/range_utils.pyj +++ b/src/pyj/range_utils.pyj @@ -126,7 +126,7 @@ def create_wrapper_function(wrapper_elem, r, intersecting_wrappers, process_wrap wrapper_counter = 0 -def wrap_text_in_range(styler, r, process_wrapper): +def wrap_text_in_range(styler, r, class_to_add, process_wrapper): if not r: sel = window.getSelection() if not sel or not sel.rangeCount: @@ -136,6 +136,8 @@ def wrap_text_in_range(styler, r, process_wrapper): return None, v'[]' wrapper_elem = document.createElement('span') + if class_to_add: + wrapper_elem.classList.add(class_to_add) wrapper_elem.dataset.calibreRangeWrapper = v'++wrapper_counter' + '' if styler: styler(wrapper_elem) diff --git a/src/pyj/read_book/iframe.pyj b/src/pyj/read_book/iframe.pyj index 265689daca..cab7b04923 100644 --- a/src/pyj/read_book/iframe.pyj +++ b/src/pyj/read_book/iframe.pyj @@ -748,7 +748,8 @@ class IframeBoss: return bounds = cfi_for_selection() style = highlight_style_as_css(data.style, opts.is_dark_theme, opts.color_scheme.foreground) - annot_id, intersecting_wrappers = wrap_text_in_range(style, None, self.add_highlight_listeners) + cls = 'crw-has-dot' if data.has_notes else None + annot_id, intersecting_wrappers = wrap_text_in_range(style, None, cls, self.add_highlight_listeners) removed_highlights = v'[]' if annot_id is not None: intersecting_uuids = {annot_id_uuid_map[x]:True for x in intersecting_wrappers} @@ -788,7 +789,8 @@ class IframeBoss: if not r: continue style = highlight_style_as_css(h.style, opts.is_dark_theme, opts.color_scheme.foreground) - annot_id, intersecting_wrappers = wrap_text_in_range(style, r, self.add_highlight_listeners) + cls = 'crw-has-dot' if h.notes else None + annot_id, intersecting_wrappers = wrap_text_in_range(style, r, cls, self.add_highlight_listeners) if annot_id is not None: annot_id_uuid_map[annot_id] = h.uuid for crw in intersecting_wrappers: diff --git a/src/pyj/read_book/selection_bar.pyj b/src/pyj/read_book/selection_bar.pyj index e2d7862585..314a4cd36b 100644 --- a/src/pyj/read_book/selection_bar.pyj +++ b/src/pyj/read_book/selection_bar.pyj @@ -686,7 +686,8 @@ class SelectionBar: self.current_highlight_style = ed.current_style self.current_notes = ed.current_notes self.send_message( - 'apply-highlight', style=self.current_highlight_style.style, uuid=short_uuid(), existing=ed.annot_id + 'apply-highlight', style=self.current_highlight_style.style, uuid=short_uuid(), existing=ed.annot_id, + has_notes=v'!!self.current_notes' ) self.state = WAITING self.update_position() @@ -743,7 +744,7 @@ class SelectionBar: self.create_highlight() else: self.current_notes = '' - self.send_message('apply-highlight', style=self.current_highlight_style.style, uuid=short_uuid()) + self.send_message('apply-highlight', style=self.current_highlight_style.style, uuid=short_uuid(), has_notes=False) self.state = WAITING self.update_position() diff --git a/src/pyj/read_book/settings.pyj b/src/pyj/read_book/settings.pyj index 17f4af2427..eef232eb34 100644 --- a/src/pyj/read_book/settings.pyj +++ b/src/pyj/read_book/settings.pyj @@ -97,6 +97,20 @@ def apply_colors(is_content_popup): # for firefox: https://developer.mozilla.org/en-US/docs/Web/CSS/scrollbar-width text += '\nhtml, body { scrollbar-width: none !important }' + # show a dot after highlights that have notes + text += '''\n\n + .crw-has-dot::after { + content: "\xa0";\ + vertical-align: text-top;\ + background-color: currentColor !important;\ + text-decoration: none !important;\ + display: inline-block;\ + height: 0.7ex;\ + width: 0.7ex;\ + border-radius: 50%;\ + } + ''' + ss.textContent = text