Class MarkdownDocumentEditor

Wrapper around the Editor WebBrowser Control and the embedded Ace Editor instance that is contained within it. This class manages creation of the WebBrowser instance and handles configuration and event firing. It also provides event interfaces for AceEditor callbacks and methods to affect the behavior of the AceEditor instance using the low level AceEditor property.

System.Object
  MarkdownMonster.MarkdownDocumentEditor
public class MarkdownDocumentEditor : object, INotifyPropertyChanged

Class Members

MemberDescription

Constructor

PropertyChanged

AddLinkReference

Inserts a Link Reference into the document based on a link and title

public Task AddLinkReference(string link,     string linkText)

AddWordToDictionary

Adds a new word to add-on the dictionary for a given locale

public void AddWordToDictionary(string word,     string lang)

AttachPreviewBrowser

Attaches the Preview Browser to this editor instance

public void AttachPreviewBrowser()

CheckSpelling

Check spelling of an individual word - called from ACE Editor

public bool CheckSpelling(string text,     string language,     bool reload)

EditorContextMenu

Shows the Editor Context Menu at the current position

called from editor

public void EditorContextMenu()

EditorSelectionOperation

Fired from Editor Menu when items are selected

public Task EditorSelectionOperation(string action,     string text)

ExecEditorCommand

public Task ExecEditorCommand(string action,     object parm)

GetCurrentLine

Retrieves the text of the current line as a string.

public Task GetCurrentLine()

GetCursorPosition

REturns the editor's cursor position as row and column values

public Task GetCursorPosition()

GetFontSize

Returns the font size of the editor. Note font-size automatically affects all open editor instances .

public Task GetFontSize()

GetLine

Retrieves the text for the given line

public Task GetLine(int rowNumber)

GetLineNumber

Gets the active line number of the editor

public Task GetLineNumber()

GetMarkdown

Reads the markdown text from the editor control

public Task GetMarkdown()

GetProperty

Returns a value from the Properties Collection as a sepcific type

public T GetProperty(string key)

public T GetProperty(string key,     T defaultValue)

GetPropertyString

Returns a Property from the Properties collection as a string

public string GetPropertyString(string key,     string defaultValue)

GetSelection

Gets the current selection of the editor

public Task GetSelection()

GetSelectionRange

Returns an object that holds the current selection's start and end position row and column values.

public Task GetSelectionRange()

GetSuggestions

Shows spell check context menu options

public void GetSuggestions(string text,     string language,     bool reload,     string jsonRange)

GotoBottom

goes to the bottom of the editor

public Task GotoBottom(bool noRefresh,     bool noSelection)

GotoLine

Goes to the specified line number in the editor

public Task GotoLine(int line,     bool noRefresh,     bool noSelection)

IsDirty

public Task IsDirty(bool previewIfDirty)

IsPreviewToEditorSync

public bool IsPreviewToEditorSync()

LoadDocumentIntoEditor

Loads an existing MarkdownDocument into the editor for display/editing.

public void LoadDocumentIntoEditor(MarkdownDocument mdDoc)

LogError

Allows the editor to log an error in the MM error log.

public void LogError(string errorMessage)

MarkupMarkdown

Takes action on the selected string in the editor using predefined commands.

public Task MarkupMarkdown(string action,     string input,     string style)

MoveCursorPosition

public Task MoveCursorPosition(int column,     int row)

NotifyAddins

Allows the Editor to raise events that can be captured by Addins that are subscribed to OnNotifyAddin.

public Task NotifyAddins(string command,     object parameter)

OnPropertyChanged

public virtual void OnPropertyChanged(string propertyName)

PrefixSelectedLine

Prefixes the currently selected line with characters specified.

public Task PrefixSelectedLine(string prefix,     Char[] trimStartCharacters)

PreviewContextMenu

public void PreviewContextMenu(object positionAndElementType)

PreviewLinkNavigation

Pre-processing for HREF link clicks in the Preview document

.md documents are navigated by opening http links are navigated with Shell browsers if PreviewExternal is enabled Addins can intercept and if return true handle navigation completely.

public Task PreviewLinkNavigation(string url,     string src)

PreviewMarkdownCallback

Callback handler callable from JavaScript editor///

public Task PreviewMarkdownCallback(bool dontGetMarkdown,     int editorLineNumber,     bool noPreviewScrolling)

ProcessEditorUpdateCommand

Takes a command like bold,italic,href etc., reads the text from editor selection, transforms it and pastes it back into the document.

public Task ProcessEditorUpdateCommand(string action)

ReleaseEditor

Releases the Editor and Preview Pane explicitly

public void ReleaseEditor()

RemoveMarkdownFormatting

Removes markdown formatting from the editor selection. Non-markdown files don't do anything.

public Task RemoveMarkdownFormatting()

RemovePreviewBrowser

public void RemovePreviewBrowser()

RenderMarkdown

Renders Markdown as HTML

public string RenderMarkdown(string markdown,     bool renderLinksExternal,     bool usePragmaLines)

ReplaceContent

Replaces the editor's content without completely reloading the document.

Leaves scroll position intact.

public Task ReplaceContent(string text)

ResizeWindow

public void ResizeWindow()

RestyleEditor

Restyles the current editor with configuration settings from the mmApp.Configuration object (or Model.Configuration from an addin).

public Task RestyleEditor(bool forceSync,     bool initialize)

SaveDocument

Saves the active document to file using the filename defined on the MarkdownDocument.

If there's no active filename a file save dialog If there's no active filename a file save dialog is popped up.

public Task SaveDocument(bool isEncrypted)

ScrollPreviewToEditorLineCallback

Scrolls the preview editor - typically in response to editor scroll or click operations based on the PreviewSyncMode setting

public void ScrollPreviewToEditorLineCallback(int editorLineNumber,     bool updateCodeBlocks,     bool noScrollTimeout,     bool noScrollTopAdjustment)

SetCursorPosition

Set's the editor's row and column position

public Task SetCursorPosition(int col,     int row)

public Task SetCursorPosition(AcePosition pos)

SetDirty

Sets the Markdown Document as having changes

public Task SetDirty(bool value)

SetEditorFocus

Focuses the Markdown editor in the Window

public Task SetEditorFocus()

SetEditorSyntax

Sets the Syntax language to highlight for in the editor

public Task SetEditorSyntax(string syntax)

SetMarkdown

Sets the markdown text into the editor control

public Task SetMarkdown(string markdown,     object position,     bool updateDirtyFlag,     bool keepUndoBuffer)

SetMarkdownMonsterWindowFocus

Force focus away from the Markdown Editor by focusing on one of the controls in the Window

public void SetMarkdownMonsterWindowFocus()

SetReadOnly

Makes the document readonly or read-write

Fires event when ReadOnly document is double clicked: OnNotifyAddin("ReadOnlyEditorDoubleClick",editor)

public Task SetReadOnly(bool show)

SetSelection

Pastes text into the editor at the current insertion/selection point. Replaces any selected text.

public Task SetSelection(string text)

SetSelectionAndFocus

Sets selection, sets focus to the editor and refreshes the preview

public Task SetSelectionAndFocus(string text)

SetSelectionRange

public Task SetSelectionRange(AcePosition start,     AcePosition end)

public Task SetSelectionRange(int startRow,     int startColumn,     int endRow,     int endColumn)

SetShowInvisibles

Enables or disables the display of invisible characters.

public Task SetShowInvisibles(bool? show)

SetShowLineNumbers

Sets line number gutter on and off. Separated out from Restyle Editor to allow line number config to be set separately from main editor settings for specialty file editing.

public Task SetShowLineNumbers(bool? show)

SetSpellChecking

Turns on Spell checking - gets applied in the next editor refresh when document IsDirty is checked.

public void SetSpellChecking(bool turnOff)

SetWordWrap

Enables or disables Wordwrap

public Task SetWordWrap(bool enable)

ShowMessage

Displays a message box

public string ShowMessage(string text,     string title,     string icon,     string buttons)

ShowStatus

Allows the client to show status messages

public void ShowStatus(string text)

ShowStatusError

Allows the client to show status messages

public void ShowStatusError(string text)

SpellCheckDocument

Forces the document to be spell checked again

public void SpellCheckDocument()

ToString

public virtual string ToString()

WrapValue

Wraps a string with beginning and ending delimiters. Fixes up accidental leading and trailing spaces.

public string WrapValue(string input,     string delim1,     string delim2,     bool stripExtraSpaces)

Configuration

Custom Configuration that is local and overrides main behavior

EditorHandler

Instance of the Web Browser control that hosts ACE Editor

EditorPreviewPane

HasHtmlPreview

Determines if the editor requires an HTML preview window

Identifier

Optional identifier that lets you specify what type of document we're dealing with.

Can be used by Addins to create customer editors or handle displaying the document a different way.

InitialLineNumber

IsDirtyAction

Allows intercepting changes that occur when the document is updated.

Must be an async operation.

Passed in bool value for existing dirty value Return your updated dirty bool value

Passes in: isDirty Status, markdown, origMarkdown Returns: isDirty Status

IsPreview

Determines if the the document is treated as a preview

IsReadOnly

Determines whether the editor displays as a read-only document

JsEditor

Shortcut reference to the JavaScript Editor Interop interface

MarkdownDocument

References the loaded MarkdownDocument instance. Note this value can be null before the document has been loaded.

NoInitialFocus

Determines whether the editor is initially focused

Properties

Optional storage object that allows you to store additional data for the document. Useful for plug-ins that may want to keep things with the document for rendering or other purposes.

SplitMode

Determines if and how the editor split display is handled.

TabLoadingCompleted

Optional event you can hook if you need to know when the tab and the document inside of it have completely loaded. Useful for operations that might have to set and manipulate content after initial loading

Window

Reference back to the main Markdown Monster window that

Requirements

Namespace: MarkdownMonster
Assembly: markdownmonster.exe

© West Wind Technologies, 1996-2021 • Updated: 11/23/21
Comment or report problem with topic