Documentation ¶
Overview ¶
Custom multline text entry widget
Contains markdown editor toolbar component ¶
Functions for altering the content of the text editor text ¶
Markdown styling and editing actions for the editor toolbar
Index ¶
- Variables
- func New(e *MultiLineWidget) *widget.Toolbar
- type MarkdownToolbar
- type MultiLineWidget
- func (m *MultiLineWidget) Content() string
- func (m *MultiLineWidget) ContentRows() []string
- func (m *MultiLineWidget) CursorPosition() shared.Position
- func (m *MultiLineWidget) DebugTextSelection()
- func (m *MultiLineWidget) GetSelection() shared.TextSelection
- func (m *MultiLineWidget) Redo()
- func (m *MultiLineWidget) RowCount() int
- func (m *MultiLineWidget) SelectedRowRange() (int, int)
- func (m *MultiLineWidget) SelectionStart() shared.Position
- func (m *MultiLineWidget) SetContent(t string)
- func (m *MultiLineWidget) Undo()
- type Position
- type TextSelection
Constants ¶
This section is empty.
Variables ¶
var Icons = icons.ToolbarIcons
var MARKDOWN_PREFIXES_EXTENDED = append(MARKDOWN_ROW_PREFIXES, " > ", "```", "-----")
Markdown row prefixes extended set, including quote blocks, code blocks, and line breaks
var MARKDOWN_ROW_PREFIXES = []string{
"# ", "## ", "### ", "#### ", "##### ",
"- [ ] ", "- [x] ",
"- ",
"1. ", "2. ", "3. ", "4. ", "5. ", "6. ", "7. ", "8. ", "9.", "10. ",
}
These patterns will be assume as styling at the beginning of a row, and will be replaced during replaceRowPrefix operations. FIXME: replace this simplistic pattern check with regex
Functions ¶
func New ¶
func New(e *MultiLineWidget) *widget.Toolbar
New returns a new toolbar component for the markdown text editor, with attached functions and icons
Types ¶
type MarkdownToolbar ¶
type MarkdownToolbar struct {
Toolbar fyne.Widget
}
MarkdownToolbar is a toolbar for the markdown text editor
type MultiLineWidget ¶
MultiLineWidget is a custom multiline entry widget, with improved cursor functions
func NewMultilineWidget ¶
func NewMultilineWidget(content string) *MultiLineWidget
NewMultilineWidget returns a new custom multiline widget
func (*MultiLineWidget) Content ¶
func (m *MultiLineWidget) Content() string
Content returns the editor's text content
func (*MultiLineWidget) ContentRows ¶
func (m *MultiLineWidget) ContentRows() []string
ContentRows returns the content of the widget, broken into rows by newline
func (*MultiLineWidget) CursorPosition ¶
func (m *MultiLineWidget) CursorPosition() shared.Position
CursorPosition returns the cursor position, in row/column format
func (*MultiLineWidget) DebugTextSelection ¶
func (m *MultiLineWidget) DebugTextSelection()
Debug current text selection
func (*MultiLineWidget) GetSelection ¶
func (m *MultiLineWidget) GetSelection() shared.TextSelection
GetSelection returns the current text selection and position. The Fyne entry widget counts position from 0,0. This function returns position from 1,1, to match standard editor conventions.
func (*MultiLineWidget) Redo ¶
func (m *MultiLineWidget) Redo()
Redo the most recent changes to the text content
func (*MultiLineWidget) RowCount ¶
func (m *MultiLineWidget) RowCount() int
RowCount returns the number of rows in the text content
func (*MultiLineWidget) SelectedRowRange ¶
func (m *MultiLineWidget) SelectedRowRange() (int, int)
SelectedRowRange returns the row numbers of the current text selection. This returns start -> end, regardless if the selection is forwards or backwards. For example, if the current selection spans from rows 2 to 3, this would return 2,3 IF the selection is reversed, it will still return 2,3
func (*MultiLineWidget) SelectionStart ¶
func (m *MultiLineWidget) SelectionStart() shared.Position
SelectionStart returns the selection cursor start position.
func (*MultiLineWidget) SetContent ¶
func (m *MultiLineWidget) SetContent(t string)
SetContent replaces the editor's text content
func (*MultiLineWidget) Undo ¶
func (m *MultiLineWidget) Undo()
Undo the most recent changes to the text content
type TextSelection ¶
type TextSelection = shared.TextSelection