コード例 #1
0
        public MarkdownEditor()
        {
            InitializeComponent();
            NameScope.SetNameScope(EditorContextMenu, NameScope.GetNameScope(this));

            Editor.TextArea.SelectionChanged += SelectionChanged;
            Editor.PreviewMouseLeftButtonUp  += HandleMouseUp;
            Editor.MouseMove += HandleEditorMouseMove;
            Editor.PreviewMouseLeftButtonDown += HandleEditorPreviewMouseLeftButtonDown;

            Editor.MouseMove             += (s, e) => e.Handled = true;
            Editor.TextArea.TextEntering += TextAreaTextEntering;

            CommandBindings.Add(new CommandBinding(FormattingCommands.ToggleBold, (x, y) => ToggleBold(), CanEditDocument));
            CommandBindings.Add(new CommandBinding(FormattingCommands.ToggleItalic, (x, y) => ToggleItalic(), CanEditDocument));
            CommandBindings.Add(new CommandBinding(FormattingCommands.ToggleCode, (x, y) => ToggleCode(), CanEditDocument));
            CommandBindings.Add(new CommandBinding(FormattingCommands.ToggleCodeBlock, (x, y) => ToggleCodeBlock(), CanEditDocument));
            CommandBindings.Add(new CommandBinding(FormattingCommands.SetHyperlink, (x, y) => SetHyperlink(), CanEditDocument));

            var overtypeMode = new OvertypeMode();

            editorPreviewKeyDownHandlers = new IHandle <EditorPreviewKeyDownEvent>[] {
                new CopyLeadingWhitespaceOnNewLine(),
                new PasteImageIntoDocument(),
                new PasteURLIntoDocument(),
                new ControlRightTweakedForMarkdown(),
                new HardLineBreak(),
                overtypeMode,
                new AutoContinueLists(),
                new IndentLists(() => IndentType)
            };
            editorTextEnteringHandlers = new IHandle <EditorTextEnteringEvent>[] {
                overtypeMode
            };
        }
コード例 #2
0
        public MarkdownEditor()
        {
            InitializeComponent();
            NameScope.SetNameScope(EditorContextMenu, NameScope.GetNameScope(this));

            Editor.TextArea.SelectionChanged += SelectionChanged;
            Editor.PreviewMouseLeftButtonUp += HandleMouseUp;
            Editor.MouseMove += HandleEditorMouseMove;
            Editor.PreviewMouseLeftButtonDown += HandleEditorPreviewMouseLeftButtonDown;

            Editor.MouseMove += (s, e) => e.Handled = true;
            Editor.TextArea.TextEntering += TextAreaTextEntering;

            CommandBindings.Add(new CommandBinding(FormattingCommands.ToggleBold, (x, y) => ToggleBold(), CanEditDocument));
            CommandBindings.Add(new CommandBinding(FormattingCommands.ToggleItalic, (x, y) => ToggleItalic(), CanEditDocument));
            CommandBindings.Add(new CommandBinding(FormattingCommands.ToggleCode, (x, y) => ToggleCode(), CanEditDocument));
            CommandBindings.Add(new CommandBinding(FormattingCommands.ToggleCodeBlock, (x, y) => ToggleCodeBlock(), CanEditDocument));
            CommandBindings.Add(new CommandBinding(FormattingCommands.SetHyperlink, (x, y) => SetHyperlink(), CanEditDocument));

            var overtypeMode = new OvertypeMode();

            editorPreviewKeyDownHandlers = new IHandle<EditorPreviewKeyDownEvent>[] {
                new CopyLeadingWhitespaceOnNewLine(),
                new PasteImageIntoDocument(),
                new PasteURLIntoDocument(),
                new ControlRightTweakedForMarkdown(),
                new HardLineBreak(),
                overtypeMode,
                new AutoContinueLists(),
                new IndentLists(()=>IndentType)
            };
            editorTextEnteringHandlers = new IHandle<EditorTextEnteringEvent>[] {
                overtypeMode
            };
        }
コード例 #3
0
        public MarkdownEditor()
        {
            InitializeComponent();

            Editor.TextArea.SelectionChanged += SelectionChanged;
            Editor.PreviewMouseLeftButtonUp += HandleMouseUp;
            Editor.MouseMove += HandleEditorMouseMove;
            Editor.PreviewMouseLeftButtonDown += HandleEditorPreviewMouseLeftButtonDown;

            Editor.MouseMove += (s, e) => e.Handled = true;
            Editor.TextArea.TextEntering += new TextCompositionEventHandler(TextArea_TextEntering);

            CommandBindings.Add(new CommandBinding(FormattingCommands.ToggleBold, (x, y) => ToggleBold(), CanEditDocument));
            CommandBindings.Add(new CommandBinding(FormattingCommands.ToggleItalic, (x, y) => ToggleItalic(), CanEditDocument));
            CommandBindings.Add(new CommandBinding(FormattingCommands.ToggleCode, (x, y) => ToggleCode(), CanEditDocument));
            CommandBindings.Add(new CommandBinding(FormattingCommands.ToggleCodeBlock, (x, y) => ToggleCodeBlock(), CanEditDocument));
            CommandBindings.Add(new CommandBinding(FormattingCommands.SetHyperlink, (x, y) => SetHyperlink(), CanEditDocument));

            var overtypeMode = new OvertypeMode();

            editorPreviewKeyDownHandlers = new IHandle<EditorPreviewKeyDownEvent>[] {
                new CopyLeadingWhitespaceOnNewLine(),
                new PasteImagesUsingSiteContext(),
                new CursorLeftRightWithSelection(),
                new ControlRightTweakedForMarkdown(),
                new HardLineBreak(),
                overtypeMode
            };
            editorTextEnteringHandlers = new IHandle<EditorTextEnteringEvent>[] {
                overtypeMode
            };
        }