WebAPI/KeboardIME: Difference between revisions

Line 159: Line 159:


  // Insert a string at the current cursor position
  // Insert a string at the current cursor position
  conn.commitText('Hello world');
  conn.replaceSurroundingText('Hello world');
 
// Clear delete 5 characters before the cursor position.
conn.replaceSurroundingText('', 5);


  // Get the selected text
  // Get the selected text
Line 165: Line 168:
     var selectedText = text;
     var selectedText = text;
  });
  });
// Get notified when the text content has changed.
conn.ontextchange = function() {
  conn.getText(0, conn.textLength, function(text) {
    console.log(text);
  }
}


  // Move the cursor position
  // Move the cursor position
Confirmed users
58

edits