mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Add native isMisspelled method
This commit is contained in:
@@ -27,7 +27,7 @@ namespace v8_extensions {
|
||||
"exists", "read", "write", "absolute", "getAllFilePathsAsync", "traverseTree", "isDirectory",
|
||||
"isFile", "remove", "writeToPasteboard", "readFromPasteboard", "quit", "watchPath", "unwatchPath",
|
||||
"getWatchedPaths", "unwatchAllPaths", "makeDirectory", "move", "moveToTrash", "reload", "lastModified",
|
||||
"md5ForPath", "exec", "getPlatform", "setWindowState", "getWindowState"
|
||||
"md5ForPath", "exec", "getPlatform", "setWindowState", "getWindowState", "isMisspelled"
|
||||
};
|
||||
|
||||
CefRefPtr<CefV8Value> nativeObject = CefV8Value::CreateObject(NULL);
|
||||
@@ -521,6 +521,13 @@ namespace v8_extensions {
|
||||
return true;
|
||||
}
|
||||
|
||||
else if (name == "isMisspelled") {
|
||||
NSString *word = stringFromCefV8Value(arguments[0]);
|
||||
NSRange range = [[NSSpellChecker sharedSpellChecker] checkSpellingOfString:word startingAt:0];
|
||||
retval = CefV8Value::CreateBool(range.length > 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user