Added Spell Check extension
This commit is contained in:
parent
c17d35015b
commit
fc2ec7ccc2
@ -24,9 +24,12 @@
|
||||
"crel": "git@github.com:KoryNunn/crel.git#8dbda04b129fc0aec01a2a080d1cab26816e11c1",
|
||||
"waitForImages": "git@github.com:alexanderdickson/waitForImages.git#~1.4.2",
|
||||
"to-markdown": "git@github.com:benweet/to-markdown.git#jquery",
|
||||
"js-yaml": "~2.1.0"
|
||||
"js-yaml": "~2.1.0",
|
||||
"Typo.js": "git@github.com:cfinke/Typo.js.git",
|
||||
"xregexp": "d06eff50f87d81d2dd3afc1e854784c38b17bcc4"
|
||||
},
|
||||
"resolutions": {
|
||||
"jquery": "2.0.3"
|
||||
"jquery": "2.0.3",
|
||||
"xregexp": "d06eff50f87d81d2dd3afc1e854784c38b17bcc4"
|
||||
}
|
||||
}
|
||||
|
201
res/dictionaries/en_US.aff
Normal file
201
res/dictionaries/en_US.aff
Normal file
@ -0,0 +1,201 @@
|
||||
SET ISO8859-1
|
||||
TRY esianrtolcdugmphbyfvkwzESIANRTOLCDUGMPHBYFVKWZ'
|
||||
NOSUGGEST !
|
||||
|
||||
# ordinal numbers
|
||||
COMPOUNDMIN 1
|
||||
# only in compounds: 1th, 2th, 3th
|
||||
ONLYINCOMPOUND c
|
||||
# compound rules:
|
||||
# 1. [0-9]*1[0-9]th (10th, 11th, 12th, 56714th, etc.)
|
||||
# 2. [0-9]*[02-9](1st|2nd|3rd|[4-9]th) (21st, 22nd, 123rd, 1234th, etc.)
|
||||
COMPOUNDRULE 2
|
||||
COMPOUNDRULE n*1t
|
||||
COMPOUNDRULE n*mp
|
||||
WORDCHARS 0123456789
|
||||
|
||||
PFX A Y 1
|
||||
PFX A 0 re .
|
||||
|
||||
PFX I Y 1
|
||||
PFX I 0 in .
|
||||
|
||||
PFX U Y 1
|
||||
PFX U 0 un .
|
||||
|
||||
PFX C Y 1
|
||||
PFX C 0 de .
|
||||
|
||||
PFX E Y 1
|
||||
PFX E 0 dis .
|
||||
|
||||
PFX F Y 1
|
||||
PFX F 0 con .
|
||||
|
||||
PFX K Y 1
|
||||
PFX K 0 pro .
|
||||
|
||||
SFX V N 2
|
||||
SFX V e ive e
|
||||
SFX V 0 ive [^e]
|
||||
|
||||
SFX N Y 3
|
||||
SFX N e ion e
|
||||
SFX N y ication y
|
||||
SFX N 0 en [^ey]
|
||||
|
||||
SFX X Y 3
|
||||
SFX X e ions e
|
||||
SFX X y ications y
|
||||
SFX X 0 ens [^ey]
|
||||
|
||||
SFX H N 2
|
||||
SFX H y ieth y
|
||||
SFX H 0 th [^y]
|
||||
|
||||
SFX Y Y 1
|
||||
SFX Y 0 ly .
|
||||
|
||||
SFX G Y 2
|
||||
SFX G e ing e
|
||||
SFX G 0 ing [^e]
|
||||
|
||||
SFX J Y 2
|
||||
SFX J e ings e
|
||||
SFX J 0 ings [^e]
|
||||
|
||||
SFX D Y 4
|
||||
SFX D 0 d e
|
||||
SFX D y ied [^aeiou]y
|
||||
SFX D 0 ed [^ey]
|
||||
SFX D 0 ed [aeiou]y
|
||||
|
||||
SFX T N 4
|
||||
SFX T 0 st e
|
||||
SFX T y iest [^aeiou]y
|
||||
SFX T 0 est [aeiou]y
|
||||
SFX T 0 est [^ey]
|
||||
|
||||
SFX R Y 4
|
||||
SFX R 0 r e
|
||||
SFX R y ier [^aeiou]y
|
||||
SFX R 0 er [aeiou]y
|
||||
SFX R 0 er [^ey]
|
||||
|
||||
SFX Z Y 4
|
||||
SFX Z 0 rs e
|
||||
SFX Z y iers [^aeiou]y
|
||||
SFX Z 0 ers [aeiou]y
|
||||
SFX Z 0 ers [^ey]
|
||||
|
||||
SFX S Y 4
|
||||
SFX S y ies [^aeiou]y
|
||||
SFX S 0 s [aeiou]y
|
||||
SFX S 0 es [sxzh]
|
||||
SFX S 0 s [^sxzhy]
|
||||
|
||||
SFX P Y 3
|
||||
SFX P y iness [^aeiou]y
|
||||
SFX P 0 ness [aeiou]y
|
||||
SFX P 0 ness [^y]
|
||||
|
||||
SFX M Y 1
|
||||
SFX M 0 's .
|
||||
|
||||
SFX B Y 3
|
||||
SFX B 0 able [^aeiou]
|
||||
SFX B 0 able ee
|
||||
SFX B e able [^aeiou]e
|
||||
|
||||
SFX L Y 1
|
||||
SFX L 0 ment .
|
||||
|
||||
REP 88
|
||||
REP a ei
|
||||
REP ei a
|
||||
REP a ey
|
||||
REP ey a
|
||||
REP ai ie
|
||||
REP ie ai
|
||||
REP are air
|
||||
REP are ear
|
||||
REP are eir
|
||||
REP air are
|
||||
REP air ere
|
||||
REP ere air
|
||||
REP ere ear
|
||||
REP ere eir
|
||||
REP ear are
|
||||
REP ear air
|
||||
REP ear ere
|
||||
REP eir are
|
||||
REP eir ere
|
||||
REP ch te
|
||||
REP te ch
|
||||
REP ch ti
|
||||
REP ti ch
|
||||
REP ch tu
|
||||
REP tu ch
|
||||
REP ch s
|
||||
REP s ch
|
||||
REP ch k
|
||||
REP k ch
|
||||
REP f ph
|
||||
REP ph f
|
||||
REP gh f
|
||||
REP f gh
|
||||
REP i igh
|
||||
REP igh i
|
||||
REP i uy
|
||||
REP uy i
|
||||
REP i ee
|
||||
REP ee i
|
||||
REP j di
|
||||
REP di j
|
||||
REP j gg
|
||||
REP gg j
|
||||
REP j ge
|
||||
REP ge j
|
||||
REP s ti
|
||||
REP ti s
|
||||
REP s ci
|
||||
REP ci s
|
||||
REP k cc
|
||||
REP cc k
|
||||
REP k qu
|
||||
REP qu k
|
||||
REP kw qu
|
||||
REP o eau
|
||||
REP eau o
|
||||
REP o ew
|
||||
REP ew o
|
||||
REP oo ew
|
||||
REP ew oo
|
||||
REP ew ui
|
||||
REP ui ew
|
||||
REP oo ui
|
||||
REP ui oo
|
||||
REP ew u
|
||||
REP u ew
|
||||
REP oo u
|
||||
REP u oo
|
||||
REP u oe
|
||||
REP oe u
|
||||
REP u ieu
|
||||
REP ieu u
|
||||
REP ue ew
|
||||
REP ew ue
|
||||
REP uff ough
|
||||
REP oo ieu
|
||||
REP ieu oo
|
||||
REP ier ear
|
||||
REP ear ier
|
||||
REP ear air
|
||||
REP air ear
|
||||
REP w qu
|
||||
REP qu w
|
||||
REP z ss
|
||||
REP ss z
|
||||
REP shun tion
|
||||
REP shun sion
|
||||
REP shun cion
|
62120
res/dictionaries/en_US.dic
Normal file
62120
res/dictionaries/en_US.dic
Normal file
File diff suppressed because it is too large
Load Diff
@ -34,6 +34,7 @@ define([
|
||||
"extensions/buttonHtmlCode",
|
||||
"extensions/buttonViewer",
|
||||
"extensions/welcomeTour",
|
||||
"extensions/spellCheck",
|
||||
"extensions/userCustom",
|
||||
"bootstrap",
|
||||
"jquery-waitforimages"
|
||||
|
@ -34,7 +34,8 @@ define([
|
||||
"to-markdown": "https://github.com/domchristie/to-markdown",
|
||||
"UI Layout": "http://layout.jquery-dev.net/",
|
||||
"Underscore.js": "http://underscorejs.org/",
|
||||
"waitForImages": "https://github.com/alexanderdickson/waitForImages"
|
||||
"waitForImages": "https://github.com/alexanderdickson/waitForImages",
|
||||
"XRegExp": "https://github.com/slevithan/xregexp"
|
||||
};
|
||||
|
||||
var projects = {
|
||||
|
50
res/extensions/spellCheck.js
Normal file
50
res/extensions/spellCheck.js
Normal file
@ -0,0 +1,50 @@
|
||||
define([
|
||||
"jquery",
|
||||
"underscore",
|
||||
"utils",
|
||||
"classes/Extension",
|
||||
"typo-js",
|
||||
"xregexp",
|
||||
"text!dictionaries/en_US.dic",
|
||||
"text!dictionaries/en_US.aff",
|
||||
"text!html/tocSettingsBlock.html",
|
||||
], function($, _, utils, Extension, Typo, XRegExp, dic, aff, tocSettingsBlockHTML) {
|
||||
|
||||
var spellCheck = new Extension("spellCheck", "Spell Check", true);
|
||||
spellCheck.settingsBlock = tocSettingsBlockHTML;
|
||||
|
||||
var aceEditor = undefined;
|
||||
spellCheck.onAceCreated = function(aceEditorParam) {
|
||||
aceEditor = aceEditorParam;
|
||||
};
|
||||
|
||||
var context = undefined;
|
||||
spellCheck.onFileClose = function() {
|
||||
if (context !== undefined) {
|
||||
_.each(context.markers, function(marker) {
|
||||
aceEditor.session.removeMarker(marker);
|
||||
});
|
||||
}
|
||||
context = undefined;
|
||||
};
|
||||
|
||||
var dictionary = new Typo('en_US', aff, dic);
|
||||
spellCheck.onFileOpen = function() {
|
||||
context = {
|
||||
markers: []
|
||||
};
|
||||
var Range = require('ace/range').Range;
|
||||
var lines = aceEditor.session.getDocument().getAllLines();
|
||||
_.each(lines, function(line, index) {
|
||||
line.replace(XRegExp('\\p{L}+', 'g'), function(word, offset) {
|
||||
if (!dictionary.check(word)) {
|
||||
console.log(word);
|
||||
var range = new Range(index, offset, index, offset + word.length);
|
||||
context.markers[index] = aceEditor.session.addMarker(range, "misspelled", "typo", true);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return spellCheck;
|
||||
});
|
14
res/main.js
14
res/main.js
@ -51,7 +51,12 @@ requirejs.config({
|
||||
'pagedown-extra': 'bower-libs/pagedown-extra/Markdown.Extra',
|
||||
'ace/requirejs/text': 'libs/ace_text',
|
||||
'ace/commands/default_commands': 'libs/ace_commands',
|
||||
'js-yaml': 'bower-libs/js-yaml/js-yaml'
|
||||
'js-yaml': 'bower-libs/js-yaml/js-yaml',
|
||||
'require-css': 'bower-libs/require-css/css',
|
||||
Typo: 'bower-libs/Typo.js',
|
||||
'typo-js': 'bower-libs/Typo.js/typo/typo',
|
||||
xregexp: 'bower-libs/xregexp/xregexp-all',
|
||||
'Typo.js': 'bower-libs/Typo.js'
|
||||
},
|
||||
shim: {
|
||||
underscore: {
|
||||
@ -69,9 +74,12 @@ requirejs.config({
|
||||
mousetrap: {
|
||||
exports: 'Mousetrap'
|
||||
},
|
||||
'typo-js': {
|
||||
exports: 'Typo'
|
||||
},
|
||||
'bootstrap-record': [
|
||||
'mousetrap'
|
||||
],
|
||||
'mousetrap'
|
||||
],
|
||||
toMarkdown: {
|
||||
deps: [
|
||||
'jquery'
|
||||
|
@ -1024,6 +1024,8 @@ ul,ol {
|
||||
.ace_description {
|
||||
color: @primary-color-lighter;
|
||||
}
|
||||
|
||||
.ace_marker-layer .misspelled { position: absolute; z-index: -2; border-bottom: 1px dotted red; margin-bottom: -1px; }
|
||||
}
|
||||
|
||||
.ace_search {
|
||||
|
Loading…
Reference in New Issue
Block a user