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