mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-10 17:33:24 +01:00
Fix select of text.
This commit is contained in:
parent
f86e3e085b
commit
859a95d1d1
@ -77,18 +77,19 @@ const TopicLink = (props: {
|
||||
onChange={(event) => setUrl(event.target.value)}
|
||||
variant="outlined"
|
||||
size="small"
|
||||
type="url"
|
||||
onKeyDown={keyDownHandler}
|
||||
InputProps={{
|
||||
endAdornment: (
|
||||
<Link href={isValidUrl ? url : ''} target="_blank">
|
||||
<IconButton disabled={!isValidUrl}>
|
||||
<OpenInNewOutlinedIcon></OpenInNewOutlinedIcon>
|
||||
<OpenInNewOutlinedIcon />
|
||||
</IconButton>
|
||||
</Link>
|
||||
),
|
||||
}}
|
||||
margin="dense"
|
||||
></Input>
|
||||
/>
|
||||
<br />
|
||||
<SaveAndDelete
|
||||
model={props.urlModel}
|
||||
|
@ -21,6 +21,8 @@ import $ from 'jquery';
|
||||
|
||||
import ActionDispatcher from './ActionDispatcher';
|
||||
import Events from './Events';
|
||||
import { FontStyleType } from './FontStyleType';
|
||||
import { FontWeightType } from './FontWeightType';
|
||||
import Topic from './Topic';
|
||||
|
||||
class EditorComponent extends Events {
|
||||
@ -77,7 +79,7 @@ class EditorComponent extends Events {
|
||||
}
|
||||
textareaElem.val(`${head}\n${tail}`);
|
||||
|
||||
textareaElem.focus();
|
||||
textareaElem.trigger('focus');
|
||||
textareaElem[0].setSelectionRange(cursorPosition + 1, cursorPosition + 1);
|
||||
} else {
|
||||
this.close(true);
|
||||
@ -186,8 +188,8 @@ class EditorComponent extends Events {
|
||||
|
||||
private setStyle(fontStyle: {
|
||||
fontFamily: string;
|
||||
style: string;
|
||||
weight: string;
|
||||
style: FontStyleType;
|
||||
weight: FontWeightType;
|
||||
size: number;
|
||||
color: string;
|
||||
}) {
|
||||
@ -234,6 +236,7 @@ class EditorComponent extends Events {
|
||||
private positionCursor(textareaElem: JQuery<HTMLTextAreaElement>, selectText: boolean) {
|
||||
const { length } = this.getTextAreaText();
|
||||
const start = selectText ? 0 : length;
|
||||
textareaElem.trigger('focus');
|
||||
textareaElem[0].setSelectionRange(start, length);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user