WriteopiaManager

class WriteopiaManager(stepsNormalizer: UnitsNormalizationMap = StepsMapNormalizationBuilder.reduceNormalizations { defaultNormalizers() }, movementHandler: MovementHandler = MovementHandler(), contentHandler: ContentHandler = ContentHandler( stepsNormalizer = stepsNormalizer ), focusHandler: FocusHandler = FocusHandler())

Constructors

Link copied to clipboard
constructor(stepsNormalizer: UnitsNormalizationMap = StepsMapNormalizationBuilder.reduceNormalizations { defaultNormalizers() }, movementHandler: MovementHandler = MovementHandler(), contentHandler: ContentHandler = ContentHandler( stepsNormalizer = stepsNormalizer ), focusHandler: FocusHandler = FocusHandler())

Functions

Link copied to clipboard
fun bulkDelete(positions: Iterable<Int>, stories: Map<Int, StoryStep>): Pair<Map<Int, StoryStep>, Map<Int, StoryStep>>

Deletes the whole selection. All StoryStep in the selection will be deleted.

Link copied to clipboard

Changes the state of a story step based of the stateChange

Link copied to clipboard
fun changeStoryType(position: Int, typeInfo: TypeInfo, commandInfo: CommandInfo?, storyState: StoryState): StoryState

Changes the story type. The type of a messages changes without changing the content of it. Commands normally change the type of a message. From a message to a unordered list item, for example.

Link copied to clipboard
fun collapseItem(storyState: StoryState, position: Int): StoryState
Link copied to clipboard
fun expandItem(storyState: StoryState, position: Int): StoryState
Link copied to clipboard

Merges two StoryStep into a group. This can be used to merge two images into a message group or any other kind of group.

Link copied to clipboard
fun moveRequest(move: Action.Move, storyState: StoryState): StoryState

A request to move a content to a position.

Link copied to clipboard
fun newStory(documentId: String = GenerateId.generate(), title: String = "", parentFolder: String = "root"): Pair<DocumentInfo, StoryState>
Link copied to clipboard
fun nextFocusOrCreate(position: Int, cursor: Int, storyState: StoryState): StoryState

Moves the focus to the next available StoryStep if it can't find a step to focus, it creates a new StoryStep at the end of the document.

Link copied to clipboard
fun onDelete(deleteStory: Action.DeleteStory, storyState: StoryState): StoryState?

Deletes a StoryStep

Link copied to clipboard
fun onErase(deleteStory: Action.EraseStory, storyState: StoryState): StoryState

Erases a StoryStep

Link copied to clipboard

Creates a line break. When a line break happens, the line it divided into two StorySteps of the same, if possible, or the next line will be a Message.

Link copied to clipboard
fun previousTextStory(storyMap: Map<Int, StoryStep>, position: Int): Pair<StoryStep, Int>?
Link copied to clipboard
fun removeTags(position: Int, storyState: StoryState): StoryState