Documentation ¶
Overview ¶
Base window for the app
Miscellaneous small UI components ¶
Edit gist view ¶
Functions for open, close, and save files ¶
Modal for configuring the Github API token ¶
The main file menu
Index ¶
- Variables
- func ButtonContainer(numItems int, objects ...fyne.CanvasObject) *fyne.Container
- func FileMenu(cfg *AppConfig) (*fyne.MainMenu, func(bool))
- func ReadGithubToken() (string, error)
- func StartUI()
- func TitleBox(msg string) *fyne.Container
- func TitleText(msg string) fyne.Widget
- type AppConfig
- func (cfg *AppConfig) CloseFile()
- func (cfg *AppConfig) Exit()
- func (cfg *AppConfig) LoadConfig() error
- func (cfg *AppConfig) MakeUI()
- func (AppConfig) New() AppConfig
- func (cfg *AppConfig) NewFile()
- func (cfg *AppConfig) OpenFile()
- func (cfg *AppConfig) RunUI()
- func (cfg *AppConfig) SaveFile()
- func (cfg *AppConfig) SaveFileAs()
- func (cfg *AppConfig) ShowEditWindow()
- func (cfg *AppConfig) ShowGithubTokenModal()
- func (cfg *AppConfig) ShowListWindow()
- type Editor
- type GistFile
- type GithubSettingsWindow
- type ListView
- type MainWindow
- type PreviewEditContainer
Constants ¶
This section is empty.
Variables ¶
var CONFIG_DIR_NAME = "./gist-editor" // FIXME: should not be hardcoded
Path under the user's home directory for storing app configuration
var GITHUB_CONFIG_FILE = path.Join(userConfigPath(), "github-token.txt") // FIXME: Improve file format
Functions ¶
func ButtonContainer ¶
func ButtonContainer(numItems int, objects ...fyne.CanvasObject) *fyne.Container
Button container with padding and right alignment
func ReadGithubToken ¶
ReadGithubToken reads and returns the Github API token, if it exists.
Types ¶
type AppConfig ¶
type AppConfig struct { App *fyne.App MainWindow MainWindow ListWindow *ListView Editor *Editor CurrentFile *GistFile GithubConfig *github.GithubConfig GithubSettingsWindow *GithubSettingsWindow }
Basic app structure, with windows and other data to be passed around
func (*AppConfig) CloseFile ¶
func (cfg *AppConfig) CloseFile()
CloseFile closes the currently open markdown file and closes the editor window
func (*AppConfig) LoadConfig ¶
LoadConfig reads and stores the config settings from the config file
func (*AppConfig) MakeUI ¶
func (cfg *AppConfig) MakeUI()
Generate and store the basic UI components
func (*AppConfig) NewFile ¶
func (cfg *AppConfig) NewFile()
NewFile opens a new empty markdown editor
func (*AppConfig) SaveFile ¶
func (cfg *AppConfig) SaveFile()
SaveFile saves the currently open markdown file locally to disk
func (*AppConfig) SaveFileAs ¶
func (cfg *AppConfig) SaveFileAs()
SaveFileAs saves the currently open markdown file locally to disk with a new filename
func (*AppConfig) ShowGithubTokenModal ¶
func (cfg *AppConfig) ShowGithubTokenModal()
Show the Github Token modal
func (*AppConfig) ShowListWindow ¶
func (cfg *AppConfig) ShowListWindow()
Show the All Gists list view
type Editor ¶
type Editor struct { *editor.MultiLineWidget Title string IsVisible bool // contains filtered or unexported fields }
Editor represents the Gist editor window, and provides methods to update the title & content of the editor widget
func (*Editor) Clear ¶
func (e *Editor) Clear()
Clear resets the title and contents of the text editor
func (*Editor) Redo ¶
func (e *Editor) Redo()
Redo performs an redo operation on the text editor content
func (*Editor) SetContent ¶
SetContent sets the contents of the text editor field
type GistFile ¶
A GistFile represents a currently open local or remote markdown file
type GithubSettingsWindow ¶
type GithubSettingsWindow struct {
// contains filtered or unexported fields
}
GithubSettingsWindow is the the Github config settings window
func (GithubSettingsWindow) Hide ¶
func (g GithubSettingsWindow) Hide()
Hide hides the Github settings modal
func (*GithubSettingsWindow) Load ¶
func (g *GithubSettingsWindow) Load(cfg *AppConfig) error
Load reads the github setting from file, and stores to the app config.
func (GithubSettingsWindow) New ¶
func (g GithubSettingsWindow) New(cfg *AppConfig) *GithubSettingsWindow
New returns a new instance of the GithubSettingsWindow
func (GithubSettingsWindow) Show ¶
func (g GithubSettingsWindow) Show()
Show shows the Github settings modal
type ListView ¶
type ListView struct {
// contains filtered or unexported fields
}
ListView is the user's Gist list view window
type MainWindow ¶
type MainWindow struct { Window fyne.Window SetCanSave func(bool) // toggle whether Save / SaveAs is allowed in the main menu // contains filtered or unexported fields }
MainWindow is the main app window with menu & methods for create & show
func (MainWindow) Close ¶
func (m MainWindow) Close()
Close Closes the main window and starts the application
func (MainWindow) New ¶
func (m MainWindow) New(cfg *AppConfig) MainWindow
New intitializes the main window UI and returns a MainWindow instance
func (MainWindow) ShowAndRun ¶
func (m MainWindow) ShowAndRun()
Show shows the main window and starts the application
type PreviewEditContainer ¶
type PreviewEditContainer struct { Content *container.Split // split view of the preview and edit panes ToggleButton *widget.Button // the toggle Preview button // contains filtered or unexported fields }
PreviewEditContainer is the wrapper for the Preview and Edit panes. It shows the editor on the left, with preview on the right in split view. The toggle method hides the preview pane (moves to collapsed state).
func (PreviewEditContainer) New ¶
func (p PreviewEditContainer) New( previewPane *fyne.Container, editPane *fyne.Container, ) *PreviewEditContainer
New returns a new PreviewEditContainer with toggle functionality
func (*PreviewEditContainer) PreviewIsVisible ¶
func (p *PreviewEditContainer) PreviewIsVisible() bool
PreviewIsVisible returns whether the markdown preview pane is visible, determined by the offset attribute of the Split element. If the user has adjusted it, it may be visible.
func (*PreviewEditContainer) TogglePreview ¶
func (p *PreviewEditContainer) TogglePreview()
TogglePreview toggles the visiblility of the markdown preview pane.