Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
retypos-webclient
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eterfund
retypos-webclient
Commits
6ebb777c
Commit
6ebb777c
authored
Jun 29, 2018
by
Георгий Попов
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add config file to store some const values
parent
d5e9eb40
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
9 deletions
+17
-9
index.js
src/App/index.js
+10
-9
config.js
src/config.js
+7
-0
No files found.
src/App/index.js
View file @
6ebb777c
import
React
,
{
Component
}
from
'react'
;
import
$
from
'jquery'
;
import
TypoModal
from
'../Modal/'
import
{
i18n
}
from
'../Localization'
import
TypoModal
from
'../Modal/'
;
import
{
i18n
}
from
'../Localization'
;
import
{
config
}
from
'../config'
;
class
App
extends
Component
{
...
...
@@ -13,9 +15,6 @@ class App extends Component {
correctionMode
:
false
}
this
.
minSelectionLength
=
4
;
this
.
maxSelectionLength
=
50
;
this
.
typo
=
""
;
this
.
registerHandlers
();
...
...
@@ -33,11 +32,11 @@ class App extends Component {
$
(
document
).
keydown
(
event
=>
{
if
(
event
.
ctrlKey
&&
event
.
keyCode
===
13
)
{
const
selection
=
this
.
getSelectedText
();
if
(
selection
.
length
<
this
.
minSelection
Length
||
selection
.
length
>
this
.
maxSelection
Length
)
if
(
selection
.
length
<
config
.
minTypo
Length
||
selection
.
length
>
config
.
maxTypo
Length
)
{
alert
(
i18n
.
formatString
(
i18n
.
errorSelectionLength
,
this
.
minSelectionLength
,
this
.
maxSelection
Length
));
config
.
minTypoLength
,
config
.
maxTypo
Length
));
return
;
}
...
...
@@ -56,7 +55,9 @@ class App extends Component {
if
(
!
this
.
state
.
correctionMode
)
return
null
;
return
(
<
TypoModal
text
=
{
this
.
typo
}
closeCallback
=
{
this
.
modalClosedCallback
}
show
=
{
this
.
state
.
correctionMode
}
/
>
<
TypoModal
text
=
{
this
.
typo
}
closeCallback
=
{
this
.
modalClosedCallback
}
show
=
{
this
.
state
.
correctionMode
}
/
>
);
}
...
...
src/config.js
0 → 100644
View file @
6ebb777c
export
const
config
=
{
maxTypoLength
:
50
,
minTypoLength
:
2
,
maxCorrectLength
:
100
,
minCorrectLength
:
1
,
};
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment