Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
03f625f4
Commit
03f625f4
authored
Mar 28, 2017
by
Alexander.Trofimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug 34556
autocomplete if length of value d'not equal to length of autocomplete value
parent
4427739b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
24 deletions
+17
-24
cell/view/CellEditorView.js
cell/view/CellEditorView.js
+17
-24
No files found.
cell/view/CellEditorView.js
View file @
03f625f4
...
...
@@ -154,7 +154,7 @@
//-----------------
this
.
objAutoComplete
=
{};
this
.
isAutoComplete
=
false
;
this
.
sAutoComplete
=
null
;
/** @type RegExp */
this
.
reReplaceNL
=
/
\r?\n
|
\r
/g
;
...
...
@@ -188,7 +188,7 @@
var
t
=
this
;
var
z
=
t
.
defaults
.
canvasZIndex
;
this
.
defaults
.
padding
=
settings
.
padding
;
this
.
isAutoComplete
=
false
;
this
.
sAutoComplete
=
null
;
if
(
null
!=
this
.
element
)
{
t
.
canvasOuter
=
document
.
createElement
(
'
div
'
);
...
...
@@ -330,19 +330,12 @@
// Иначе F2 по ячейке с '\n', у которой выключен wrap, не станет снова wrap. http://bugzilla.onlyoffice.com/show_bug.cgi?id=17590
if
(
0
<
this
.
undoList
.
length
||
isFormula
||
this
.
textFlags
.
wrapOnlyNL
)
{
// Делаем замену текста на автодополнение, если есть select и текст полностью совпал.
if
(
this
.
isAutoComplete
&&
!
isFormula
)
{
var
s
=
this
.
_getFragmentsText
(
this
.
options
.
fragments
);
if
(
!
AscCommon
.
isNumber
(
s
))
{
var
arrAutoComplete
=
this
.
_getAutoComplete
(
s
.
toLowerCase
());
if
(
1
===
arrAutoComplete
.
length
)
{
var
newValue
=
arrAutoComplete
[
0
];
this
.
selectionBegin
=
this
.
textRender
.
getBeginOfText
();
this
.
cursorPos
=
this
.
selectionEnd
=
this
.
textRender
.
getEndOfText
();
this
.
noUpdateMode
=
true
;
this
.
_addChars
(
newValue
);
this
.
noUpdateMode
=
false
;
}
}
if
(
this
.
sAutoComplete
&&
!
isFormula
)
{
this
.
selectionBegin
=
this
.
textRender
.
getBeginOfText
();
this
.
cursorPos
=
this
.
selectionEnd
=
this
.
textRender
.
getEndOfText
();
this
.
noUpdateMode
=
true
;
this
.
_addChars
(
this
.
sAutoComplete
);
this
.
noUpdateMode
=
false
;
}
ret
=
opt
.
saveValueCallback
(
opt
.
fragments
,
this
.
textFlags
,
/*skip NL check*/
ret
);
...
...
@@ -1501,7 +1494,7 @@
CellEditor
.
prototype
.
_moveCursor
=
function
(
kind
,
pos
)
{
var
t
=
this
;
this
.
isAutoComplete
=
false
;
this
.
sAutoComplete
=
null
;
switch
(
kind
)
{
case
kPrevChar
:
t
.
cursorPos
=
t
.
textRender
.
getPrevChar
(
t
.
cursorPos
);
...
...
@@ -1673,7 +1666,7 @@
return
false
;
}
this
.
isAutoComplete
=
false
;
this
.
sAutoComplete
=
null
;
this
.
dontUpdateText
=
true
;
if
(
this
.
selectionBegin
!==
this
.
selectionEnd
)
{
...
...
@@ -1800,7 +1793,7 @@
var
t
=
this
;
var
begPos
,
endPos
;
this
.
isAutoComplete
=
false
;
this
.
sAutoComplete
=
null
;
begPos
=
t
.
selectionBegin
===
t
.
selectionEnd
?
t
.
cursorPos
:
t
.
selectionBegin
;
t
.
_moveCursor
(
kind
,
pos
);
endPos
=
t
.
cursorPos
;
...
...
@@ -2102,19 +2095,19 @@
}
};
CellEditor
.
prototype
.
_getAutoComplete
=
function
(
str
)
{
CellEditor
.
prototype
.
_getAutoComplete
=
function
(
str
)
{
// ToDo можно ускорить делая поиск каждый раз не в большом массиве, а в уменьшенном (по предыдущим символам)
var
oLastResult
=
this
.
objAutoComplete
[
str
];
if
(
oLastResult
)
{
if
(
oLastResult
)
{
return
oLastResult
;
}
var
arrAutoComplete
=
this
.
options
.
autoComplete
;
var
arrAutoCompleteLC
=
this
.
options
.
autoCompleteLC
;
var
i
,
length
,
arrResult
=
[];
for
(
i
=
0
,
length
=
arrAutoCompleteLC
.
length
;
i
<
length
;
++
i
)
{
if
(
0
===
arrAutoCompleteLC
[
i
].
indexOf
(
str
)
)
{
arrResult
.
push
(
arrAutoComplete
[
i
]
);
for
(
i
=
0
,
length
=
arrAutoCompleteLC
.
length
;
i
<
length
;
++
i
)
{
if
(
arrAutoCompleteLC
[
i
].
length
!==
str
.
length
&&
0
===
arrAutoCompleteLC
[
i
].
indexOf
(
str
)
)
{
arrResult
.
push
(
arrAutoComplete
[
i
]
);
}
}
return
this
.
objAutoComplete
[
str
]
=
arrResult
;
...
...
@@ -2573,7 +2566,7 @@
t
.
_addChars
(
newValue
.
substring
(
lengthInput
));
t
.
selectionBegin
=
tmpCursorPos
;
t
.
_selectChars
(
kEndOfText
);
this
.
isAutoComplete
=
tr
ue
;
this
.
sAutoComplete
=
newVal
ue
;
}
}
}
...
...
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