Skip to content

Commit

Permalink
first try on scrolling tracker #28
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-virkus committed Mar 6, 2022
1 parent 7461661 commit bc5d4cc
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion lib/src/editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,17 @@ class HtmlEditorState extends State<HtmlEditor> {
var fontSize = undefined;
var fontFamily = undefined;
var isChildOfList = false;
// var boundingRectFound = false;
while (node.parentNode != null && node.id != 'editor') {
// if (!boundingRectFound && node.getBoundingClientRect) {
// var boundingRect = node.getBoundingClientRect();
// if (boundingRect) {
// console.log('bounding rect found for', node, boundingRect);
// boundingRectFound = true;
// window.OffsetTracker.postMessage(JSON.stringify(boundingRect));
// }
// }
if (node.nodeName == 'B') {
isBold = true;
} else if (node.nodeName === 'I') {
Expand Down Expand Up @@ -173,7 +182,7 @@ class HtmlEditorState extends State<HtmlEditor> {
}
node = node.parentNode;
}
isInList = isChildOfList;
isInList = isChildOfList;
if (isBold != isSelectionBold || isItalic != isSelectionItalic || isUnderline != isSelectionUnderline || isStrikeThrough != isSelectionStrikeThrough) {
isSelectionBold = isBold;
isSelectionItalic = isItalic;
Expand Down Expand Up @@ -457,6 +466,12 @@ blockquote {
name: 'InternalUpdate',
onMessageReceived: _onInternalUpdateReceived,
),
// JavascriptChannel(
// name: 'OffsetTracker',
// onMessageReceived: (msg) {
// print('OffsetTracker: [${msg.message}]');
// },
// ),
},

// deny browsing while editing:
Expand Down

0 comments on commit bc5d4cc

Please sign in to comment.