Class MarkdownMonsterAddin

Addin Base class that exposes core functionality to the addin.

System.Object
  MarkdownMonster.AddIns.MarkdownMonsterAddin
public abstract class MarkdownMonsterAddin : object

Class Members

MemberDescription

AddMenuItem

Allows insertion of a menu item

public bool AddMenuItem(MenuItem mitem,     string menuItemNameForInsertionAfter,     string menuItemTextForInsertionAfter,     int mode)

CloseTab

Closes a specific tab that you pass. You can look at the tab collection via Model.Window.TabControl.

public void CloseTab(TabItem tab)

public void CloseTab(string filename)

ExecuteEditCommand

Executes a predefined edit command (bold,italic,href etc.) against the editor.

public void ExecuteEditCommand(string action)

GetMarkdown

Returns the active live markdown text from the editor

public string GetMarkdown()

GetMarkdownDocument

Returns the Markdown document instance which has access to the actual document that ends up being saved. This includes the content and the IsDirty flag. Note that content is updated only after save operations. If you need to update live content it's best to inject directly into the edtor using the GetSelectedText() and SetSelectedText().

public MarkdownDocument GetMarkdownDocument()

GetMarkdownEditor

Retrieve an instance of the MarkdownEditor control from the active window. This instance wraps the editor and provides a number of methods for getting access to the editor document

public MarkdownDocumentEditor GetMarkdownEditor()

GetMarkdownParser

If this addin wants to provide a custom Markdown Parser this method can be overriden to do it.

public virtual IMarkdownParser GetMarkdownParser(bool usePragmaLines,     bool force)

GetPreviewBrowserUserControl

Allows returning a WPF control that implements IPreviewBrowser and that handles previewing the output from documents.

This control should return an IPreviewBrowser interface implemented on a WPF UIControl (UserControl most likely).

public virtual IPreviewBrowser GetPreviewBrowserUserControl()

GetSelection

Gets the active selection from the editor

public string GetSelection()

OnAfterOpenDocument

Called after a new document has been opened. If this is a new document the filename will be 'untitled'

public virtual void OnAfterOpenDocument(MarkdownDocument doc)

OnAfterSaveDocument

Called after the document has been saved.

public virtual void OnAfterSaveDocument(MarkdownDocument doc)

OnApplicationShutdown

Called just before the application is shut down

public virtual void OnApplicationShutdown()

OnApplicationStart

Called when the application starts and after the AddinManager has initialized.

Use this handler to add new menu items to the Addin Toolbar.

public virtual void OnApplicationStart()

OnBeforeOpenDocument

Called before a document is opened. Return false to keep the document from being opened

public virtual bool OnBeforeOpenDocument(string filename)

OnBeforeSaveDocument

Called before the document is saved. Return false to disallow saving the document

public virtual bool OnBeforeSaveDocument(MarkdownDocument doc)

OnCanExecute

Called to determine whether the menu option should be enabled and execute

public virtual bool OnCanExecute(object sender)

OnDocumentActivated

Called whenever a new document is activated in the editor (when tabs change). Note on startup if multiple documents are open this method is called for each document.

public virtual void OnDocumentActivated(MarkdownDocument doc)

OnDocumentUpdated

Called whenever the document is updated and the document's current text is updated. Note this may not be always 100% in sync of what's in the editor as the document is updated only when the user stops typing for around a second.

public virtual void OnDocumentUpdated()

OnEditorCommand

Optional editor command handler that can intercept editor commands like bold/italic that are fired if not handled previously by the default handlers.

Allows adding custom handlers

public virtual string OnEditorCommand(string command,     string input)

OnExecute

Called when the Menu or Toolbar button is clicked

public virtual void OnExecute(object sender)

OnExecuteConfiguration

Called when the configuration Toolbar drop down button is clicked

public virtual void OnExecuteConfiguration(object sender)

OnInstall

Called after the addin is initially installed. Use this method to install additional resources or add additional one time configuration.

public virtual void OnInstall()

OnModelLoaded

Fired when the application has Initialized the Model. This happens after OnApplicationStart() but before OnWindowLoaded() and allows you to access the Model before initial data binding of the Window occurs.

public virtual void OnModelLoaded(AppModel model)

OnModifyPreviewHtml

Allows addins to intercept the html used for the preview, to examine or further manipulate it, e.g. insert a style block in the head.

public virtual string OnModifyPreviewHtml(string renderedHtml,     string markdownHtml)

OnNotifyAddin

An optional command string that is fired into addins

You can override this method to capture commands that are not already handled by the editor.

public virtual void OnNotifyAddin(string command,     object parameter)

OnPreviewLinkNavigation

Allows you to detect Preview Browser Link navigation and take over the navigation.

public virtual bool OnPreviewLinkNavigation(string url,     string src)

OnSaveImage

Called when an image is to be saved. By default MM saves images to disk. You can hook this method with your add in to take over the image save operation. Return true to indicate you handled the

public virtual string OnSaveImage(object image)

OnUninstall

Called after the addin has been uninstalled. Allows for additional cleanup.

public virtual void OnUninstall()

OnWindowLoaded

public virtual void OnWindowLoaded()

OpenTab

Opens a tab with a given filename and selects it

public TabItem OpenTab(string filename)

RefreshPreview

Refreshes the Html Preview Window if active

public void RefreshPreview(bool keepScrollPosition)

SetEditorFocus

Brings the editor to focus

public void SetEditorFocus()

SetMarkdown

Sets all the text in the markdown editor

public void SetMarkdown(string markdownText)

SetSelection

Sets the active selection from the editor

public void SetSelection(string text)

ShowStatus

Displays a status message on the main application's status bar

public void ShowStatus(string message,     int timeoutMs,     FontAwesomeIcon icon,     Color color,     bool spin)

ShowStatusError

Displays and error message on the status bar using common default values (red icon, standard timeout, warning icon)

public void ShowStatusError(string message,     int timeout,     FontAwesomeIcon icon,     Color color)

ActiveDocument

Returns the active Markdown document that's being edited. The document holds the actual markdown text and knows how to load, save and render the markdown contained within it.

ActiveEditor

Returns an instance of the Active Editor instance. The editor contains editor behavior of the browser control as well as all interactions with the editor's event model and text selection interfaces.

Contains an AceEditor property that references the underlying JavaScript editor wrapper instance.

Id

Optional Id for this addin - use a recognizable Id

IsEnabled

Determines whether this addin is enabled

MenuItems

List of menu items that are used to extend MM Menu items get attached to the Addin menu and fire when clicked.

Model

The application model which gives you access to Markdown Monster. Includes access to Configuration and the Main Window

Name

The display name of the Addin

Requirements

Namespace: MarkdownMonster.AddIns
Assembly: markdownmonster.exe

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