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

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 string EditorSelectionOperation(string action,     string text)

EmbedDroppedFileAsImage

Embeds a dropped file as an image. If not an image no action is taken

public void EmbedDroppedFileAsImage(string file)

ExecEditorCommand

public void ExecEditorCommand(string action,     object parm)

FindAndReplaceText

public void FindAndReplaceText(string search,     string replace)

FindAndReplaceTextInCurrentLine

public void FindAndReplaceTextInCurrentLine(string search,     string replace)

GetCurrentLine

Retrieves the text of the current line as a string.

public string GetCurrentLine()

GetCursorPosition

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

public AcePosition GetCursorPosition()

GetFontSize

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

public int GetFontSize()

GetKeyBindingsJson

Return keyboard bindings object as a JSON string so we can bind inside of the editor JavaScript

public string GetKeyBindingsJson()

GetLine

Retrieves the text for the given line

public string GetLine(int rowNumber)

GetLineNumber

Gets the active line number of the editor

public int GetLineNumber()

GetMarkdown

Reads the markdown text from the editor control

public string 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)

GetScrollPosition

Returns the editor's vertical scroll position

public int GetScrollPosition()

GetSelection

Gets the current selection of the editor

public string GetSelection()

GetSelectionRange

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

public SelectionRange GetSelectionRange()

GetSuggestions

Shows spell check context menu options

public void GetSuggestions(string text,     string language,     bool reload,     object range)

GotFocus

ACE Editor Notification when focus is set to the editor

public void GotFocus()

GotoLine

Goes to the specified line number in the editor

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

IsDirty

Determines whether current document is dirty and requires saving

public bool IsDirty()

IsPreviewToEditorSync

public bool IsPreviewToEditorSync()

KeyboardCommand

Performs the special key operation that is tied to the key in the application.

ctrl-s,ctrl-n, ctrl-o, cltr-i,ctrl-b,ctrl-l,ctrl-k,alt-c,ctrl-shift-v,ctrl-shift-c,ctlr-shift-down,ctrl-shift-up

public void KeyboardCommand(string key)

LoadDocument

Loads a new document into the active editor using MarkdownDocument instance.

public void LoadDocument(MarkdownDocument mdDoc,     bool forceReload)

LostFocus

ACE Editor Notification when focus is lost

public void LostFocus()

MarkupMarkdown

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

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

MoveCursorPosition

public void MoveCursorPosition(int column,     int row)

NotifyAddins

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

public void NotifyAddins(string command,     object parameter)

OnPropertyChanged

public virtual void OnPropertyChanged(string propertyName)

PasteOperation

Handle pasting and handle images

public void PasteOperation()

PreviewContextMenu

public void PreviewContextMenu(object position)

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 bool PreviewLinkNavigation(string url,     string src)

PreviewMarkdownCallback

Callback handler callable from JavaScript editor

public void PreviewMarkdownCallback(bool dontGetMarkdown,     int editorLineNumber)

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 void 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 bool 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 void 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 void 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 bool SaveDocument(bool isEncrypted)

SetCursorPosition

Set's the editor's row and column position

public void SetCursorPosition(int col,     int row)

public void SetCursorPosition(AcePosition pos)

SetDirty

Sets the Markdown Document as having changes

public bool SetDirty(bool value)

SetEditorFocus

Focuses the Markdown editor in the Window

public void SetEditorFocus()

SetEditorSyntax

Sets the Syntax language to highlight for in the editor

public void SetEditorSyntax(string syntax)

SetMarkdown

Sets the markdown text into the editor control

public void 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 void SetReadOnly(bool show)

SetScrollPosition

Sets the vertical scroll position of the document

public void SetScrollPosition(int top)

SetSelection

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

public void SetSelection(string text)

SetSelectionAndFocus

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

public void SetSelectionAndFocus(string text)

SetSelectionRange

public void SetSelectionRange(AcePosition start,     AcePosition end)

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

SetShowInvisibles

Enables or disables the display of invisible characters.

public void 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 void SetShowLineNumbers(bool? show)

SetSpellChecking

public void SetSpellChecking(bool turnOff)

SetWordWrap

Enables or disables Wordwrap

public void 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,     int timeoutms)

SpellCheckDocument

Forces the document to be spell checked again

public void SpellCheckDocument()

ToString

public virtual string ToString()

UpdateDocumentStats

Callback to force updating of the status bar document stats

public void UpdateDocumentStats(object stats)

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 stripSpaces)

AceEditor

EditorPreviewPane

EditorSyntax

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

IsPreview

Determines if the the document is treated as a preview

IsReadOnly

Determines whether the editor displays as a read-only document

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.

WebBrowser

Instance of the Web Browser control that hosts ACE Editor

Window

Reference back to the main Markdown Monster window that

Requirements

Namespace: MarkdownMonster
Assembly: markdownmonster.exe

© West Wind Technologies, 2019 • Updated: 01/06/19
Comment or report problem with topic