mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
Editor | Fix | Update mention names in headers (#2017)
Co-authored-by: konstantiniiv <ki@anytype.io>
This commit is contained in:
parent
ba209bc89b
commit
ac3f68e6cb
2 changed files with 72 additions and 48 deletions
|
@ -341,6 +341,9 @@ interface TextBlockHolder : TextHolder {
|
|||
content.pauseTextWatchers {
|
||||
enableEditMode()
|
||||
}
|
||||
content.pauseTextWatchers {
|
||||
content.applyMovementMethod(item)
|
||||
}
|
||||
} else {
|
||||
enableReadMode()
|
||||
}
|
||||
|
|
|
@ -571,23 +571,30 @@ class DefaultBlockViewRenderer(
|
|||
indent: Int,
|
||||
details: Block.Details,
|
||||
selection: Set<Id>
|
||||
): BlockView.Text.Header.Three = BlockView.Text.Header.Three(
|
||||
mode = if (mode == EditorMode.Edit) BlockView.Mode.EDIT else BlockView.Mode.READ,
|
||||
id = block.id,
|
||||
text = content.text,
|
||||
color = content.color,
|
||||
isFocused = block.id == focus.id,
|
||||
marks = content.marks(details = details, urlBuilder = urlBuilder),
|
||||
backgroundColor = content.backgroundColor,
|
||||
indent = indent,
|
||||
alignment = content.align?.toView(),
|
||||
cursor = if (block.id == focus.id) setCursor(focus, content) else null,
|
||||
isSelected = checkIfSelected(
|
||||
mode = mode,
|
||||
block = block,
|
||||
selection = selection
|
||||
): BlockView.Text.Header.Three {
|
||||
val marks = content.marks(details = details, urlBuilder = urlBuilder)
|
||||
val (normalizedText, normalizedMarks) = content.getTextAndMarks(
|
||||
details = details,
|
||||
marks = marks
|
||||
)
|
||||
)
|
||||
return BlockView.Text.Header.Three(
|
||||
mode = if (mode == EditorMode.Edit) BlockView.Mode.EDIT else BlockView.Mode.READ,
|
||||
id = block.id,
|
||||
text = normalizedText,
|
||||
color = content.color,
|
||||
isFocused = block.id == focus.id,
|
||||
marks = normalizedMarks,
|
||||
backgroundColor = content.backgroundColor,
|
||||
indent = indent,
|
||||
alignment = content.align?.toView(),
|
||||
cursor = if (block.id == focus.id) setCursor(focus, content) else null,
|
||||
isSelected = checkIfSelected(
|
||||
mode = mode,
|
||||
block = block,
|
||||
selection = selection
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private fun headerTwo(
|
||||
mode: EditorMode,
|
||||
|
@ -597,23 +604,30 @@ class DefaultBlockViewRenderer(
|
|||
indent: Int,
|
||||
details: Block.Details,
|
||||
selection: Set<Id>
|
||||
): BlockView.Text.Header.Two = BlockView.Text.Header.Two(
|
||||
mode = if (mode == EditorMode.Edit) BlockView.Mode.EDIT else BlockView.Mode.READ,
|
||||
id = block.id,
|
||||
text = content.text,
|
||||
color = content.color,
|
||||
isFocused = block.id == focus.id,
|
||||
marks = content.marks(details = details, urlBuilder = urlBuilder),
|
||||
backgroundColor = content.backgroundColor,
|
||||
indent = indent,
|
||||
alignment = content.align?.toView(),
|
||||
cursor = if (block.id == focus.id) setCursor(focus, content) else null,
|
||||
isSelected = checkIfSelected(
|
||||
mode = mode,
|
||||
block = block,
|
||||
selection = selection
|
||||
): BlockView.Text.Header.Two {
|
||||
val marks = content.marks(details = details, urlBuilder = urlBuilder)
|
||||
val (normalizedText, normalizedMarks) = content.getTextAndMarks(
|
||||
details = details,
|
||||
marks = marks
|
||||
)
|
||||
)
|
||||
return BlockView.Text.Header.Two(
|
||||
mode = if (mode == EditorMode.Edit) BlockView.Mode.EDIT else BlockView.Mode.READ,
|
||||
id = block.id,
|
||||
text = normalizedText,
|
||||
color = content.color,
|
||||
isFocused = block.id == focus.id,
|
||||
marks = normalizedMarks,
|
||||
backgroundColor = content.backgroundColor,
|
||||
indent = indent,
|
||||
alignment = content.align?.toView(),
|
||||
cursor = if (block.id == focus.id) setCursor(focus, content) else null,
|
||||
isSelected = checkIfSelected(
|
||||
mode = mode,
|
||||
block = block,
|
||||
selection = selection
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private fun headerOne(
|
||||
mode: EditorMode,
|
||||
|
@ -623,23 +637,30 @@ class DefaultBlockViewRenderer(
|
|||
indent: Int,
|
||||
details: Block.Details,
|
||||
selection: Set<Id>
|
||||
): BlockView.Text.Header.One = BlockView.Text.Header.One(
|
||||
mode = if (mode == EditorMode.Edit) BlockView.Mode.EDIT else BlockView.Mode.READ,
|
||||
id = block.id,
|
||||
text = content.text,
|
||||
color = content.color,
|
||||
isFocused = block.id == focus.id,
|
||||
marks = content.marks(details = details, urlBuilder = urlBuilder),
|
||||
backgroundColor = content.backgroundColor,
|
||||
indent = indent,
|
||||
alignment = content.align?.toView(),
|
||||
cursor = if (block.id == focus.id) setCursor(focus, content) else null,
|
||||
isSelected = checkIfSelected(
|
||||
mode = mode,
|
||||
block = block,
|
||||
selection = selection
|
||||
): BlockView.Text.Header.One {
|
||||
val marks = content.marks(details = details, urlBuilder = urlBuilder)
|
||||
val (normalizedText, normalizedMarks) = content.getTextAndMarks(
|
||||
details = details,
|
||||
marks = marks
|
||||
)
|
||||
)
|
||||
return BlockView.Text.Header.One(
|
||||
mode = if (mode == EditorMode.Edit) BlockView.Mode.EDIT else BlockView.Mode.READ,
|
||||
id = block.id,
|
||||
text = normalizedText,
|
||||
color = content.color,
|
||||
isFocused = block.id == focus.id,
|
||||
marks = normalizedMarks,
|
||||
backgroundColor = content.backgroundColor,
|
||||
indent = indent,
|
||||
alignment = content.align?.toView(),
|
||||
cursor = if (block.id == focus.id) setCursor(focus, content) else null,
|
||||
isSelected = checkIfSelected(
|
||||
mode = mode,
|
||||
block = block,
|
||||
selection = selection
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private fun checkbox(
|
||||
mode: EditorMode,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue