@aurigma/design-atoms-text
Advanced tools
Comparing version 6.21.3 to 6.21.4
@@ -34,2 +34,3 @@ import { CommandType } from "../Enums"; | ||
import { CreateNumberedListItemCmd } from "./CreateNumberedListItemCmd"; | ||
import { SelectParagraphCmd } from "./SelectParagraphCmd"; | ||
export class CommandFactory { | ||
@@ -67,2 +68,5 @@ constructor(_textManager, _fontRegistry, _clipboard) { | ||
} | ||
case CommandType.selectParagraph: { | ||
return new SelectParagraphCmd(this._textManager, initData); | ||
} | ||
case CommandType.selectAllText: { | ||
@@ -69,0 +73,0 @@ return new SelectAllTextCmd(this._textManager); |
@@ -14,2 +14,3 @@ export * from "./CommandFactory"; | ||
export * from "./SelectAllTextCmd"; | ||
export * from "./SelectParagraphCmd"; | ||
export * from "./SelectWordCmd"; | ||
@@ -16,0 +17,0 @@ export * from "./SetAlignmentCmd"; |
@@ -14,2 +14,3 @@ export * from "./CommandFactory"; | ||
export * from "./SelectAllTextCmd"; | ||
export * from "./SelectParagraphCmd"; | ||
export * from "./SelectWordCmd"; | ||
@@ -16,0 +17,0 @@ export * from "./SetAlignmentCmd"; |
@@ -8,28 +8,29 @@ export declare enum CommandType { | ||
selectWord = 5, | ||
selectAllText = 6, | ||
insertNewLine = 7, | ||
insertLineBrake = 8, | ||
insertTab = 9, | ||
insertText = 10, | ||
deleteText = 11, | ||
copyToClipboard = 12, | ||
clearFormatting = 13, | ||
setFontBold = 14, | ||
setFontItalic = 15, | ||
setFontUnderline = 16, | ||
setCapitalLetters = 17, | ||
setSubscriptLetters = 18, | ||
setSuperscriptLetters = 19, | ||
setCharStyle = 20, | ||
setParagraphStyle = 21, | ||
increaseFontSize = 22, | ||
decreaseFontSize = 23, | ||
setAlignment = 24, | ||
addListItem = 25, | ||
creteBulletedListItem = 26, | ||
creteNumberedListItem = 27, | ||
deleteListItem = 28, | ||
applyListItem = 29, | ||
increaseListItemIndent = 30, | ||
decreaseListItemIndent = 31 | ||
selectParagraph = 6, | ||
selectAllText = 7, | ||
insertNewLine = 8, | ||
insertLineBrake = 9, | ||
insertTab = 10, | ||
insertText = 11, | ||
deleteText = 12, | ||
copyToClipboard = 13, | ||
clearFormatting = 14, | ||
setFontBold = 15, | ||
setFontItalic = 16, | ||
setFontUnderline = 17, | ||
setCapitalLetters = 18, | ||
setSubscriptLetters = 19, | ||
setSuperscriptLetters = 20, | ||
setCharStyle = 21, | ||
setParagraphStyle = 22, | ||
increaseFontSize = 23, | ||
decreaseFontSize = 24, | ||
setAlignment = 25, | ||
addListItem = 26, | ||
creteBulletedListItem = 27, | ||
creteNumberedListItem = 28, | ||
deleteListItem = 29, | ||
applyListItem = 30, | ||
increaseListItemIndent = 31, | ||
decreaseListItemIndent = 32 | ||
} |
@@ -12,31 +12,32 @@ export var CommandType; | ||
CommandType[CommandType["selectWord"] = 5] = "selectWord"; | ||
CommandType[CommandType["selectAllText"] = 6] = "selectAllText"; | ||
CommandType[CommandType["selectParagraph"] = 6] = "selectParagraph"; | ||
CommandType[CommandType["selectAllText"] = 7] = "selectAllText"; | ||
// text | ||
CommandType[CommandType["insertNewLine"] = 7] = "insertNewLine"; | ||
CommandType[CommandType["insertLineBrake"] = 8] = "insertLineBrake"; | ||
CommandType[CommandType["insertTab"] = 9] = "insertTab"; | ||
CommandType[CommandType["insertText"] = 10] = "insertText"; | ||
CommandType[CommandType["deleteText"] = 11] = "deleteText"; | ||
CommandType[CommandType["copyToClipboard"] = 12] = "copyToClipboard"; | ||
CommandType[CommandType["insertNewLine"] = 8] = "insertNewLine"; | ||
CommandType[CommandType["insertLineBrake"] = 9] = "insertLineBrake"; | ||
CommandType[CommandType["insertTab"] = 10] = "insertTab"; | ||
CommandType[CommandType["insertText"] = 11] = "insertText"; | ||
CommandType[CommandType["deleteText"] = 12] = "deleteText"; | ||
CommandType[CommandType["copyToClipboard"] = 13] = "copyToClipboard"; | ||
// styles | ||
CommandType[CommandType["clearFormatting"] = 13] = "clearFormatting"; | ||
CommandType[CommandType["setFontBold"] = 14] = "setFontBold"; | ||
CommandType[CommandType["setFontItalic"] = 15] = "setFontItalic"; | ||
CommandType[CommandType["setFontUnderline"] = 16] = "setFontUnderline"; | ||
CommandType[CommandType["setCapitalLetters"] = 17] = "setCapitalLetters"; | ||
CommandType[CommandType["setSubscriptLetters"] = 18] = "setSubscriptLetters"; | ||
CommandType[CommandType["setSuperscriptLetters"] = 19] = "setSuperscriptLetters"; | ||
CommandType[CommandType["setCharStyle"] = 20] = "setCharStyle"; | ||
CommandType[CommandType["setParagraphStyle"] = 21] = "setParagraphStyle"; | ||
CommandType[CommandType["increaseFontSize"] = 22] = "increaseFontSize"; | ||
CommandType[CommandType["decreaseFontSize"] = 23] = "decreaseFontSize"; | ||
CommandType[CommandType["setAlignment"] = 24] = "setAlignment"; | ||
CommandType[CommandType["clearFormatting"] = 14] = "clearFormatting"; | ||
CommandType[CommandType["setFontBold"] = 15] = "setFontBold"; | ||
CommandType[CommandType["setFontItalic"] = 16] = "setFontItalic"; | ||
CommandType[CommandType["setFontUnderline"] = 17] = "setFontUnderline"; | ||
CommandType[CommandType["setCapitalLetters"] = 18] = "setCapitalLetters"; | ||
CommandType[CommandType["setSubscriptLetters"] = 19] = "setSubscriptLetters"; | ||
CommandType[CommandType["setSuperscriptLetters"] = 20] = "setSuperscriptLetters"; | ||
CommandType[CommandType["setCharStyle"] = 21] = "setCharStyle"; | ||
CommandType[CommandType["setParagraphStyle"] = 22] = "setParagraphStyle"; | ||
CommandType[CommandType["increaseFontSize"] = 23] = "increaseFontSize"; | ||
CommandType[CommandType["decreaseFontSize"] = 24] = "decreaseFontSize"; | ||
CommandType[CommandType["setAlignment"] = 25] = "setAlignment"; | ||
// lists | ||
CommandType[CommandType["addListItem"] = 25] = "addListItem"; | ||
CommandType[CommandType["creteBulletedListItem"] = 26] = "creteBulletedListItem"; | ||
CommandType[CommandType["creteNumberedListItem"] = 27] = "creteNumberedListItem"; | ||
CommandType[CommandType["deleteListItem"] = 28] = "deleteListItem"; | ||
CommandType[CommandType["applyListItem"] = 29] = "applyListItem"; | ||
CommandType[CommandType["increaseListItemIndent"] = 30] = "increaseListItemIndent"; | ||
CommandType[CommandType["decreaseListItemIndent"] = 31] = "decreaseListItemIndent"; | ||
CommandType[CommandType["addListItem"] = 26] = "addListItem"; | ||
CommandType[CommandType["creteBulletedListItem"] = 27] = "creteBulletedListItem"; | ||
CommandType[CommandType["creteNumberedListItem"] = 28] = "creteNumberedListItem"; | ||
CommandType[CommandType["deleteListItem"] = 29] = "deleteListItem"; | ||
CommandType[CommandType["applyListItem"] = 30] = "applyListItem"; | ||
CommandType[CommandType["increaseListItemIndent"] = 31] = "increaseListItemIndent"; | ||
CommandType[CommandType["decreaseListItemIndent"] = 32] = "decreaseListItemIndent"; | ||
})(CommandType || (CommandType = {})); |
@@ -9,34 +9,35 @@ export declare enum InputCommandType { | ||
selectCurrentWord = 6, | ||
selectAll = 7, | ||
insertNewLine = 8, | ||
insertLineBreak = 9, | ||
insertTab = 10, | ||
insertChar = 11, | ||
deleteToLeft = 12, | ||
deleteLeftWord = 13, | ||
deleteToRight = 14, | ||
deleteRightWord = 15, | ||
copyToClipboard = 16, | ||
pasteFromClipboard = 17, | ||
clearFormatting = 18, | ||
setFontBold = 19, | ||
setFontItalic = 20, | ||
setFontUnderline = 21, | ||
setCapitalLetters = 22, | ||
setSubscriptLetters = 23, | ||
setSuperscriptLetters = 24, | ||
increaseFontSize = 25, | ||
decreaseFontSize = 26, | ||
setLeftAlignment = 27, | ||
setRightAlignment = 28, | ||
setCenterAlignment = 29, | ||
createBulletedListItem = 30, | ||
createNumberedListItem = 31, | ||
createBulletedListItemWithSpace = 32, | ||
createNumberedListItemWithSpace = 33, | ||
addListItemWithSpace = 34, | ||
addListItemWithNewLine = 35, | ||
deleteListItem = 36, | ||
increaseListItemIndent = 37, | ||
decreaseListItemIndent = 38 | ||
selectCurrentParagraph = 7, | ||
selectAll = 8, | ||
insertNewLine = 9, | ||
insertLineBreak = 10, | ||
insertTab = 11, | ||
insertChar = 12, | ||
deleteToLeft = 13, | ||
deleteLeftWord = 14, | ||
deleteToRight = 15, | ||
deleteRightWord = 16, | ||
copyToClipboard = 17, | ||
pasteFromClipboard = 18, | ||
clearFormatting = 19, | ||
setFontBold = 20, | ||
setFontItalic = 21, | ||
setFontUnderline = 22, | ||
setCapitalLetters = 23, | ||
setSubscriptLetters = 24, | ||
setSuperscriptLetters = 25, | ||
increaseFontSize = 26, | ||
decreaseFontSize = 27, | ||
setLeftAlignment = 28, | ||
setRightAlignment = 29, | ||
setCenterAlignment = 30, | ||
createBulletedListItem = 31, | ||
createNumberedListItem = 32, | ||
createBulletedListItemWithSpace = 33, | ||
createNumberedListItemWithSpace = 34, | ||
addListItemWithSpace = 35, | ||
addListItemWithNewLine = 36, | ||
deleteListItem = 37, | ||
increaseListItemIndent = 38, | ||
decreaseListItemIndent = 39 | ||
} |
@@ -13,37 +13,38 @@ export var InputCommandType; | ||
InputCommandType[InputCommandType["selectCurrentWord"] = 6] = "selectCurrentWord"; | ||
InputCommandType[InputCommandType["selectAll"] = 7] = "selectAll"; | ||
InputCommandType[InputCommandType["selectCurrentParagraph"] = 7] = "selectCurrentParagraph"; | ||
InputCommandType[InputCommandType["selectAll"] = 8] = "selectAll"; | ||
// text | ||
InputCommandType[InputCommandType["insertNewLine"] = 8] = "insertNewLine"; | ||
InputCommandType[InputCommandType["insertLineBreak"] = 9] = "insertLineBreak"; | ||
InputCommandType[InputCommandType["insertTab"] = 10] = "insertTab"; | ||
InputCommandType[InputCommandType["insertChar"] = 11] = "insertChar"; | ||
InputCommandType[InputCommandType["deleteToLeft"] = 12] = "deleteToLeft"; | ||
InputCommandType[InputCommandType["deleteLeftWord"] = 13] = "deleteLeftWord"; | ||
InputCommandType[InputCommandType["deleteToRight"] = 14] = "deleteToRight"; | ||
InputCommandType[InputCommandType["deleteRightWord"] = 15] = "deleteRightWord"; | ||
InputCommandType[InputCommandType["copyToClipboard"] = 16] = "copyToClipboard"; | ||
InputCommandType[InputCommandType["pasteFromClipboard"] = 17] = "pasteFromClipboard"; | ||
InputCommandType[InputCommandType["insertNewLine"] = 9] = "insertNewLine"; | ||
InputCommandType[InputCommandType["insertLineBreak"] = 10] = "insertLineBreak"; | ||
InputCommandType[InputCommandType["insertTab"] = 11] = "insertTab"; | ||
InputCommandType[InputCommandType["insertChar"] = 12] = "insertChar"; | ||
InputCommandType[InputCommandType["deleteToLeft"] = 13] = "deleteToLeft"; | ||
InputCommandType[InputCommandType["deleteLeftWord"] = 14] = "deleteLeftWord"; | ||
InputCommandType[InputCommandType["deleteToRight"] = 15] = "deleteToRight"; | ||
InputCommandType[InputCommandType["deleteRightWord"] = 16] = "deleteRightWord"; | ||
InputCommandType[InputCommandType["copyToClipboard"] = 17] = "copyToClipboard"; | ||
InputCommandType[InputCommandType["pasteFromClipboard"] = 18] = "pasteFromClipboard"; | ||
// styles | ||
InputCommandType[InputCommandType["clearFormatting"] = 18] = "clearFormatting"; | ||
InputCommandType[InputCommandType["setFontBold"] = 19] = "setFontBold"; | ||
InputCommandType[InputCommandType["setFontItalic"] = 20] = "setFontItalic"; | ||
InputCommandType[InputCommandType["setFontUnderline"] = 21] = "setFontUnderline"; | ||
InputCommandType[InputCommandType["setCapitalLetters"] = 22] = "setCapitalLetters"; | ||
InputCommandType[InputCommandType["setSubscriptLetters"] = 23] = "setSubscriptLetters"; | ||
InputCommandType[InputCommandType["setSuperscriptLetters"] = 24] = "setSuperscriptLetters"; | ||
InputCommandType[InputCommandType["increaseFontSize"] = 25] = "increaseFontSize"; | ||
InputCommandType[InputCommandType["decreaseFontSize"] = 26] = "decreaseFontSize"; | ||
InputCommandType[InputCommandType["setLeftAlignment"] = 27] = "setLeftAlignment"; | ||
InputCommandType[InputCommandType["setRightAlignment"] = 28] = "setRightAlignment"; | ||
InputCommandType[InputCommandType["setCenterAlignment"] = 29] = "setCenterAlignment"; | ||
InputCommandType[InputCommandType["clearFormatting"] = 19] = "clearFormatting"; | ||
InputCommandType[InputCommandType["setFontBold"] = 20] = "setFontBold"; | ||
InputCommandType[InputCommandType["setFontItalic"] = 21] = "setFontItalic"; | ||
InputCommandType[InputCommandType["setFontUnderline"] = 22] = "setFontUnderline"; | ||
InputCommandType[InputCommandType["setCapitalLetters"] = 23] = "setCapitalLetters"; | ||
InputCommandType[InputCommandType["setSubscriptLetters"] = 24] = "setSubscriptLetters"; | ||
InputCommandType[InputCommandType["setSuperscriptLetters"] = 25] = "setSuperscriptLetters"; | ||
InputCommandType[InputCommandType["increaseFontSize"] = 26] = "increaseFontSize"; | ||
InputCommandType[InputCommandType["decreaseFontSize"] = 27] = "decreaseFontSize"; | ||
InputCommandType[InputCommandType["setLeftAlignment"] = 28] = "setLeftAlignment"; | ||
InputCommandType[InputCommandType["setRightAlignment"] = 29] = "setRightAlignment"; | ||
InputCommandType[InputCommandType["setCenterAlignment"] = 30] = "setCenterAlignment"; | ||
// lists | ||
InputCommandType[InputCommandType["createBulletedListItem"] = 30] = "createBulletedListItem"; | ||
InputCommandType[InputCommandType["createNumberedListItem"] = 31] = "createNumberedListItem"; | ||
InputCommandType[InputCommandType["createBulletedListItemWithSpace"] = 32] = "createBulletedListItemWithSpace"; | ||
InputCommandType[InputCommandType["createNumberedListItemWithSpace"] = 33] = "createNumberedListItemWithSpace"; | ||
InputCommandType[InputCommandType["addListItemWithSpace"] = 34] = "addListItemWithSpace"; | ||
InputCommandType[InputCommandType["addListItemWithNewLine"] = 35] = "addListItemWithNewLine"; | ||
InputCommandType[InputCommandType["deleteListItem"] = 36] = "deleteListItem"; | ||
InputCommandType[InputCommandType["increaseListItemIndent"] = 37] = "increaseListItemIndent"; | ||
InputCommandType[InputCommandType["decreaseListItemIndent"] = 38] = "decreaseListItemIndent"; | ||
InputCommandType[InputCommandType["createBulletedListItem"] = 31] = "createBulletedListItem"; | ||
InputCommandType[InputCommandType["createNumberedListItem"] = 32] = "createNumberedListItem"; | ||
InputCommandType[InputCommandType["createBulletedListItemWithSpace"] = 33] = "createBulletedListItemWithSpace"; | ||
InputCommandType[InputCommandType["createNumberedListItemWithSpace"] = 34] = "createNumberedListItemWithSpace"; | ||
InputCommandType[InputCommandType["addListItemWithSpace"] = 35] = "addListItemWithSpace"; | ||
InputCommandType[InputCommandType["addListItemWithNewLine"] = 36] = "addListItemWithNewLine"; | ||
InputCommandType[InputCommandType["deleteListItem"] = 37] = "deleteListItem"; | ||
InputCommandType[InputCommandType["increaseListItemIndent"] = 38] = "increaseListItemIndent"; | ||
InputCommandType[InputCommandType["decreaseListItemIndent"] = 39] = "decreaseListItemIndent"; | ||
})(InputCommandType || (InputCommandType = {})); |
import { EqualsOfFloatNumbers, PointF } from "@aurigma/design-atoms-model/Math"; | ||
import { TextAlignment } from "@aurigma/design-atoms-model/Product/Items"; | ||
import { CommandType, InputCommandType, Keys, MouseEventType, MoveDirectionType, NumberingFormatType } from "./Enums"; | ||
import { AddListItemCmdData, SetCursorCmdData, SetSelectionCmdData, MoveCursorCmdData, InsertNewLineCmdData, InsertLineBrakeCmdData, DeleteTextCmdData, InsertTextCmdData, SetAlignmentCmdData, SelectWordCmdData, CreateBulletedListItemCmdData, CreateNumberedListItemCmdData } from "./Commands"; | ||
import { AddListItemCmdData, SetCursorCmdData, SetSelectionCmdData, MoveCursorCmdData, InsertNewLineCmdData, InsertLineBrakeCmdData, DeleteTextCmdData, InsertTextCmdData, SetAlignmentCmdData, SelectWordCmdData, CreateBulletedListItemCmdData, CreateNumberedListItemCmdData, SelectParagraphCmdData } from "./Commands"; | ||
export class InputManager { | ||
@@ -37,2 +37,5 @@ constructor(_commandFactory, _currentTextInfo, _clipboard, _inputTextValidator) { | ||
} | ||
case InputCommandType.selectCurrentParagraph: { | ||
return [this._createCmd(CommandType.selectParagraph, new SelectParagraphCmdData(currentPoint))]; | ||
} | ||
case InputCommandType.selectCurrentWord: { | ||
@@ -203,9 +206,5 @@ return [this._createCmd(CommandType.selectWord, new SelectWordCmdData(currentPoint))]; | ||
_getMouseInputCommandType(event, currentPoint) { | ||
const isDoubleClick = event.type === MouseEventType.dblclick; | ||
const isButtonDown = event.type === MouseEventType.mousedown; | ||
const isButtonUp = event.type === MouseEventType.mouseup && this._isMouseSelectionActive === true; | ||
const isButtonUp = event.type === MouseEventType.mouseup; | ||
const isMoving = event.type === MouseEventType.mousemove && this._isMouseSelectionActive === true; | ||
if (isDoubleClick) { | ||
return InputCommandType.selectCurrentWord; | ||
} | ||
if (isButtonDown) { | ||
@@ -219,6 +218,16 @@ this._isMouseSelectionActive = true; | ||
this._isMouseSelectionActive = false; | ||
this._mouseSelectionEnd = currentPoint; | ||
return this._isMouseSelectionChanged() | ||
? InputCommandType.setSelection | ||
: InputCommandType.setCursor; | ||
if (event.isClick) { | ||
if (event.clickCount == 1) | ||
return InputCommandType.setCursor; | ||
else if (event.clickCount % 2 == 1) | ||
return InputCommandType.selectCurrentParagraph; | ||
else | ||
return InputCommandType.selectCurrentWord; | ||
} | ||
else { | ||
this._mouseSelectionEnd = currentPoint; | ||
this._isMouseSelectionChanged() | ||
? InputCommandType.setSelection | ||
: InputCommandType.setCursor; | ||
} | ||
} | ||
@@ -225,0 +234,0 @@ if (isMoving) { |
@@ -8,2 +8,3 @@ import { MouseEventType } from "../Enums"; | ||
isDrag: boolean; | ||
clickCount: number; | ||
} |
@@ -32,2 +32,6 @@ import { EventObject } from "@aurigma/design-atoms-model/EventObject"; | ||
/** | ||
* Selects a paragraph relative to the current cursor position. | ||
*/ | ||
selectCurrentParagraph(): void; | ||
/** | ||
* Selects all text. | ||
@@ -34,0 +38,0 @@ */ |
import { CommandType } from "../Enums"; | ||
import { AddListItemCmdData, ApplyListTypeCmdData, DecreaseFontSizeCmdData, DecreaseListItemIndentData, DeleteListItemCmdData, DeleteTextCmdData, IncreaseFontSizeCmdData, IncreaseListItemIndentData, InsertLineBrakeCmdData, InsertNewLineCmdData, InsertTextCmdData, MoveCursorCmdData, SelectWordCmdData, SetAlignmentCmdData, SetCharStyleCmdData, SetCursorCmdData, SetParagraphStyleCmdData, SetSelectionCmdData, CreateBulletedListItemCmdData, CreateNumberedListItemCmdData } from "../Commands"; | ||
import { AddListItemCmdData, ApplyListTypeCmdData, DecreaseFontSizeCmdData, DecreaseListItemIndentData, DeleteListItemCmdData, DeleteTextCmdData, IncreaseFontSizeCmdData, IncreaseListItemIndentData, InsertLineBrakeCmdData, InsertNewLineCmdData, InsertTextCmdData, MoveCursorCmdData, SelectWordCmdData, SetAlignmentCmdData, SetCharStyleCmdData, SetCursorCmdData, SetParagraphStyleCmdData, SetSelectionCmdData, CreateBulletedListItemCmdData, CreateNumberedListItemCmdData, SelectParagraphCmdData } from "../Commands"; | ||
/** | ||
@@ -13,2 +13,3 @@ * Executes a command of the specified type. | ||
executeCommand(type: CommandType.selectWord, data: SelectWordCmdData): void; | ||
executeCommand(type: CommandType.selectParagraph, data: SelectParagraphCmdData): void; | ||
executeCommand(type: CommandType.selectAllText): void; | ||
@@ -15,0 +16,0 @@ executeCommand(type: CommandType.insertNewLine, data: InsertNewLineCmdData): void; |
@@ -119,2 +119,4 @@ import { IPoint, RectangleF } from "@aurigma/design-atoms-model/Math"; | ||
/** @inheritDoc */ | ||
selectCurrentParagraph(): void; | ||
/** @inheritDoc */ | ||
selectAllText(): void; | ||
@@ -121,0 +123,0 @@ /** @inheritDoc */ |
@@ -285,2 +285,9 @@ import { EventObject } from "@aurigma/design-atoms-model/EventObject"; | ||
/** @inheritDoc */ | ||
selectCurrentParagraph() { | ||
const currentParagraph = this._cursorHandler.getCurrentParagraphIndex(); | ||
const paragraphRange = this._textHandler.getParagraphText(currentParagraph); | ||
this._selectionHandler.setSelectionByRange(paragraphRange); | ||
return; | ||
} | ||
/** @inheritDoc */ | ||
selectAllText() { | ||
@@ -287,0 +294,0 @@ const allText = this._textHandler.getAllText(); |
{ | ||
"name": "@aurigma/design-atoms-text", | ||
"version": "6.21.3", | ||
"version": "6.21.4", | ||
"description": "", | ||
@@ -37,3 +37,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@aurigma/design-atoms-model": "6.5.36", | ||
"@aurigma/design-atoms-model": "6.5.37", | ||
"@aurigma/text-whizz": "1.5.58", | ||
@@ -40,0 +40,0 @@ "xmldom": "^0.6.0" |
@@ -35,2 +35,3 @@ import {ICommand, ITextManager, ICommandFactory, IFontRegistry, IClipboard} from "../Interfaces"; | ||
import {CreateNumberedListItemCmd, CreateNumberedListItemCmdData} from "./CreateNumberedListItemCmd"; | ||
import {SelectParagraphCmd, SelectParagraphCmdData} from "./SelectParagraphCmd"; | ||
@@ -79,2 +80,5 @@ export class CommandFactory implements ICommandFactory { | ||
} | ||
case CommandType.selectParagraph: { | ||
return new SelectParagraphCmd(this._textManager, initData as SelectParagraphCmdData); | ||
} | ||
case CommandType.selectAllText: { | ||
@@ -81,0 +85,0 @@ return new SelectAllTextCmd(this._textManager); |
@@ -14,2 +14,3 @@ export * from "./CommandFactory"; | ||
export * from "./SelectAllTextCmd"; | ||
export * from "./SelectParagraphCmd"; | ||
export * from "./SelectWordCmd"; | ||
@@ -16,0 +17,0 @@ export * from "./SetAlignmentCmd"; |
@@ -14,2 +14,3 @@ export enum CommandType { | ||
selectWord, | ||
selectParagraph, | ||
selectAllText, | ||
@@ -16,0 +17,0 @@ |
@@ -14,2 +14,3 @@ export enum InputCommandType { | ||
selectCurrentWord, | ||
selectCurrentParagraph, | ||
selectAll, | ||
@@ -16,0 +17,0 @@ |
@@ -11,3 +11,3 @@ import {EqualsOfFloatNumbers, PointF} from "@aurigma/design-atoms-model/Math"; | ||
InsertLineBrakeCmdData, DeleteTextCmdData, InsertTextCmdData, SetAlignmentCmdData, SelectWordCmdData, | ||
CreateBulletedListItemCmdData, CreateNumberedListItemCmdData | ||
CreateBulletedListItemCmdData, CreateNumberedListItemCmdData, SelectParagraphCmdData | ||
} from "./Commands"; | ||
@@ -60,2 +60,5 @@ | ||
} | ||
case InputCommandType.selectCurrentParagraph: { | ||
return [this._createCmd(CommandType.selectParagraph, new SelectParagraphCmdData(currentPoint))]; | ||
} | ||
case InputCommandType.selectCurrentWord: { | ||
@@ -234,10 +237,6 @@ return [this._createCmd(CommandType.selectWord, new SelectWordCmdData(currentPoint))]; | ||
private _getMouseInputCommandType(event: IMouseEvent, currentPoint: PointF): InputCommandType | null { | ||
const isDoubleClick = event.type === MouseEventType.dblclick; | ||
const isButtonDown = event.type === MouseEventType.mousedown; | ||
const isButtonUp = event.type === MouseEventType.mouseup && this._isMouseSelectionActive === true; | ||
const isButtonUp = event.type === MouseEventType.mouseup; | ||
const isMoving = event.type === MouseEventType.mousemove && this._isMouseSelectionActive === true; | ||
if (isDoubleClick) { | ||
return InputCommandType.selectCurrentWord; | ||
} | ||
if (isButtonDown) { | ||
@@ -251,6 +250,16 @@ this._isMouseSelectionActive = true; | ||
this._isMouseSelectionActive = false; | ||
this._mouseSelectionEnd = currentPoint; | ||
return this._isMouseSelectionChanged() | ||
? InputCommandType.setSelection | ||
: InputCommandType.setCursor; | ||
if (event.isClick){ | ||
if (event.clickCount == 1) | ||
return InputCommandType.setCursor; | ||
else if (event.clickCount % 2 == 1) | ||
return InputCommandType.selectCurrentParagraph; | ||
else | ||
return InputCommandType.selectCurrentWord; | ||
} | ||
else{ | ||
this._mouseSelectionEnd = currentPoint; | ||
this._isMouseSelectionChanged() | ||
? InputCommandType.setSelection | ||
: InputCommandType.setCursor; | ||
} | ||
} | ||
@@ -257,0 +266,0 @@ if (isMoving) { |
@@ -9,2 +9,3 @@ import {MouseEventType} from "../Enums"; | ||
isDrag: boolean; | ||
clickCount: number; | ||
} |
@@ -39,2 +39,7 @@ import {EventObject} from "@aurigma/design-atoms-model/EventObject"; | ||
/** | ||
* Selects a paragraph relative to the current cursor position. | ||
*/ | ||
selectCurrentParagraph(): void; | ||
/** | ||
* Selects all text. | ||
@@ -41,0 +46,0 @@ */ |
@@ -7,3 +7,3 @@ import {CommandType} from "../Enums"; | ||
SetAlignmentCmdData, SetCharStyleCmdData, SetCursorCmdData, SetParagraphStyleCmdData, SetSelectionCmdData, | ||
CreateBulletedListItemCmdData, CreateNumberedListItemCmdData | ||
CreateBulletedListItemCmdData, CreateNumberedListItemCmdData, SelectParagraphCmdData | ||
} from "../Commands"; | ||
@@ -38,2 +38,4 @@ | ||
executeCommand(type: CommandType.selectParagraph, data: SelectParagraphCmdData): void; | ||
executeCommand(type: CommandType.selectAllText): void; | ||
@@ -40,0 +42,0 @@ |
@@ -348,2 +348,10 @@ import {IPoint, RectangleF} from "@aurigma/design-atoms-model/Math"; | ||
/** @inheritDoc */ | ||
selectCurrentParagraph(): void { | ||
const currentParagraph = this._cursorHandler.getCurrentParagraphIndex(); | ||
const paragraphRange = this._textHandler.getParagraphText(currentParagraph); | ||
this._selectionHandler.setSelectionByRange(paragraphRange); | ||
return; | ||
} | ||
/** @inheritDoc */ | ||
selectAllText(): void { | ||
@@ -350,0 +358,0 @@ const allText = this._textHandler.getAllText(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1200101
583
28295