setTextMarker method

Future<void> setTextMarker(
  1. @Enum.new(['spelling', 'grammar']) String type,
  2. int start,
  3. int end, {
  4. NodeId? nodeId,
  5. BackendNodeId? backendNodeId,
  6. RemoteObjectId? objectId,
})

Sets a spelling or grammar error marker on the given range of text. See https://github.com/Igalia/explainers/blob/main/force-spelling-grammar-markers/README.md Note: exactly one between nodeId, backendNodeId and objectId should be passed to identify the node. nodeId Identifier of the node. backendNodeId Identifier of the backend node. objectId JavaScript object id of the node wrapper. type The type of marker to set on the given range of text. start Start offset into the element's rendered text in UTF-16 code units. For a text control, an offset into the control's value. Offsets count text in DOM order and do not enter shadow trees. To mark text inside a shadow tree, pass the element inside the shadow tree. end End offset (exclusive) in the same units and space as start.

Implementation

Future<void> setTextMarker(
  @Enum(['spelling', 'grammar']) String type,
  int start,
  int end, {
  NodeId? nodeId,
  BackendNodeId? backendNodeId,
  runtime.RemoteObjectId? objectId,
}) async {
  assert(const ['spelling', 'grammar'].contains(type));
  await _client.send('DOM.setTextMarker', {
    'type': type,
    'start': start,
    'end': end,
    'nodeId': ?nodeId,
    'backendNodeId': ?backendNodeId,
    'objectId': ?objectId,
  });
}