Skip to content

Commit

Permalink
Merge 84af5e5 into d3f4115
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianEgbert committed Jul 11, 2021
2 parents d3f4115 + 84af5e5 commit 851fa8e
Show file tree
Hide file tree
Showing 61 changed files with 411 additions and 82 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
markdownMenu: aMarkdownEditorMenu

markdownMenu := aMarkdownEditorMenu
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
markdownMenu

^ markdownMenu
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
accessing
textMorph: aTextMorph

textMorph := aTextMorph
textMorph := aTextMorph.
self markdownMenu: (MarkdownEditorMenu newFor: aTextMorph)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
yellowButtonMenu
yellowButtonMenu: aMenu

^ aMenu addList: self yellowButtonMenuItems; yourself
^ self markdownMenu yellowButtonMenu: aMenu

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
"initialize" : "lpf 6/13/2019 12:23",
"open" : "kgr 4/29/2019 13:18" },
"instance" : {
"applyBold" : "F.S 6/9/2021 10:46",
"applyInlineOnSelectionWith:" : "F.S 6/9/2021 11:16",
"applyItalic" : "F.S 6/9/2021 10:44",
"applyStrikeout" : "F.S 6/9/2021 10:46",
"applyUserInterfaceTheme" : "jh 5/30/2021 15:58",
"blockTextStyler" : "azi 6/4/2020 11:00",
"buildEditorTextMorphWith:" : "F.S 6/9/2021 10:53",
Expand All @@ -21,7 +17,9 @@
"defaultFilename" : "F.S 5/26/2021 11:24",
"fileEnding" : "JE 5/5/2021 17:51",
"handleClose" : "jh 5/29/2021 10:50",
"initialize" : "azi 8/6/2020 06:56",
"initialize" : "JE 7/11/2021 16:34",
"markdownMenu" : "JE 7/11/2021 16:32",
"markdownMenu:" : "JE 7/11/2021 16:33",
"markdownText" : "lpf 6/13/2019 15:26",
"markdownText:" : "cg 7/5/2020 12:20",
"openFile:" : "mas 7/7/2020 12:42",
Expand All @@ -36,10 +34,9 @@
"saveText" : "JE 5/27/2021 19:40",
"saveTextInModel" : "MK 7/6/2020 14:40",
"textMorph" : "cg 7/5/2020 12:21",
"textMorph:" : "cg 7/5/2020 12:21",
"textMorph:" : "JE 7/11/2021 16:34",
"window" : "jh 5/27/2021 09:41",
"window:" : "jh 5/27/2021 09:41",
"windowSpecsFor:" : "F.S 5/26/2021 11:35",
"windowTitle" : "MK 5/11/2020 19:00",
"yellowButtonMenu:" : "F.S 6/9/2021 10:53",
"yellowButtonMenuItems" : "F.S 6/9/2021 10:52" } }
"yellowButtonMenu:" : "JE 7/11/2021 16:36" } }
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"markdownText",
"textMorph",
"currentFilePath",
"window" ],
"window",
"markdownMenu" ],
"name" : "MarkdownEditor",
"pools" : [
],
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
initialize-release
newFor: aPluggableTextMorph

^ self new pluggableTextMorph: aPluggableTextMorph
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
yellowButtonMenu
addExportItemsTo: aMenu

| items |
items := OrderedCollection withAll:
{
#-.
{'convert to html' translated. #convertToHTML}.
{'appearance...' translated. #openSettings}
}.
^ aMenu
addList: items;
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
yellowButtonMenu
addFileItemsTo: aMenu

| items |
items := OrderedCollection withAll:
{
{'new' translated. #createNewInstance}.
{'open...' translated. #openFileDialog}.
{'save' translated. #saveText}.
{'save as...' translated. #saveAsFileDialog}.
#-.
}.
^ aMenu
addList: items;
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
yellowButtonMenu
addFindReplaceItemsTo: aMenu

| inline|
inline := OrderedCollection withAll:
{
#-.
{'find...(f)' translated. #find}.
{'find again (g)' translated. #findAgain}.
{'find and replace ...' translated. #findReplace}.
{'do/replace again (j)' translated. #again}
}.
^ aMenu
addList: inline;
add: 'find and replace all' action: [self findAndReplaceAll];
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
yellowButtonMenu
addHeadingMenuItemsTo: aMenu

1 to: 6 do: [:i | aMenu add: 'level ', i action: [self applyHeadingAt: i]].
^ aMenu
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
yellowButtonMenu
addInlineItemsTo: aMenu

^ aMenu
add: 'italic' action: [self applyInlineOnSelectionWith: '*'];
add: 'bold' action: [self applyInlineOnSelectionWith: '**'];
add: 'strikeout' action: [self applyInlineOnSelectionWith: '~~'];
add: 'heading' subMenu: (self addHeadingMenuItemsTo: MenuMorph new);
add: 'link' subMenu: (self addLinkMenuItemsTo: MenuMorph new);
add: 'blockquote' action: [self applyBlockquote];
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
yellowButtonMenu
addLinkMenuItemsTo: aMenu

^ aMenu
add: '[...]()' action: [self applyLinkText];
add: '[](...)' action: [self applyLinkDestination];
add: '<...>' action: [self applyAutoLink];
addLine;
add: '![...]()' action: [self applyImageText];
add: '![](...)' action: [self applyImageDestination];
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
yellowButtonMenu
addMenuItemsSelectionTo: aMenu

^ self
addInlineItemsTo: aMenu;
addFindReplaceItemsTo: aMenu;
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
yellowButtonMenu
addMenuItemsTo: aMenu

^ self
addFileItemsTo: aMenu;
addFindReplaceItemsTo: aMenu;
addExportItemsTo: aMenu;
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
text interaction
applyAutoLink

| selection |
selection := self pluggableTextMorph textMorph selection.
self pluggableTextMorph replaceSelectionWith: '<', selection, '>'
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
text interaction
applyBlockquote

| selection |
selection := self pluggableTextMorph textMorph selection.
self pluggableTextMorph replaceSelectionWith: '>', selection
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
text interaction
applyHeadingAt: aLevel

| selection matcher prefix content |
selection := self pluggableTextMorph textMorph selection.
matcher := RxMatcher forString: '(#*)(\s*)(\S.*\S|\S)(\s*)'.
(matcher matches: selection) ifFalse: [^ nil].

content := matcher subexpression: 4.
prefix := ''.
aLevel timesRepeat: [prefix := prefix, '#'].
self pluggableTextMorph replaceSelectionWith: prefix, Character space, content, Character cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
text interaction
applyImageDestination

| selection |
selection := self pluggableTextMorph textMorph selection.
self pluggableTextMorph replaceSelectionWith: '![](', selection, ')'
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
text interaction
applyImageText

| selection |
selection := self pluggableTextMorph textMorph selection.
self pluggableTextMorph replaceSelectionWith: '![', selection, ']()'
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ text interaction
applyInlineOnSelectionWith: aDelimiter

| selection matcher prefix suffix content |
selection := self textMorph textMorph selection.
selection := self pluggableTextMorph textMorph selection.
matcher := RxMatcher forString: '(\s*)(\S.*\S|\S)(\s*)'.
(matcher matches: selection) ifFalse: [^ nil].

prefix := matcher subexpression: 2.
content := matcher subexpression: 3.
suffix := matcher subexpression: 4.

self textMorph replaceSelectionWith: prefix, aDelimiter, content, aDelimiter, suffix
self pluggableTextMorph replaceSelectionWith: prefix, aDelimiter, content, aDelimiter, suffix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
text interaction
applyLinkDestination

| selection |
selection := self pluggableTextMorph textMorph selection.
self pluggableTextMorph replaceSelectionWith: '[](', selection, ')'
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
text interaction
applyLinkText

| selection |
selection := self pluggableTextMorph textMorph selection.
self pluggableTextMorph replaceSelectionWith: '[', selection, ']()'
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
text interaction
findAndReplaceAll

| continue |
self pluggableTextMorph setSelection: #(1. 0).
self pluggableTextMorph findReplace. "Opens UI that requests Input"
continue := true.
[continue] whileTrue: [
continue := self pluggableTextMorph handleEdit: [self pluggableTextMorph textMorph editor again]]

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
pluggableTextMorph: aPluggableTextMorph

pluggableTextMorph := aPluggableTextMorph
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
pluggableTextMorph

^ pluggableTextMorph
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
text interaction
textSelected

^ self pluggableTextMorph textMorph selection notEmpty
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
yellowButtonMenu
yellowButtonMenu: aMenu

self textSelected
ifTrue: [self addMenuItemsSelectionTo: aMenu]
ifFalse: [self addMenuItemsTo: aMenu].
^ aMenu
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"class" : {
"newFor:" : "JE 7/11/2021 16:31" },
"instance" : {
"addExportItemsTo:" : "JE 7/11/2021 16:53",
"addFileItemsTo:" : "JE 7/11/2021 16:52",
"addFindReplaceItemsTo:" : "JE 7/11/2021 16:50",
"addHeadingMenuItemsTo:" : "JE 7/11/2021 16:35",
"addInlineItemsTo:" : "JE 7/11/2021 16:56",
"addLinkMenuItemsTo:" : "JE 7/11/2021 17:40",
"addMenuItemsSelectionTo:" : "JE 7/11/2021 16:51",
"addMenuItemsTo:" : "JE 7/11/2021 16:54",
"applyAutoLink" : "JE 7/11/2021 16:38",
"applyBlockquote" : "JE 7/11/2021 16:38",
"applyHeadingAt:" : "JE 7/11/2021 17:45",
"applyImageDestination" : "JE 7/11/2021 17:22",
"applyImageText" : "JE 7/11/2021 17:22",
"applyInlineOnSelectionWith:" : "JE 7/11/2021 16:40",
"applyLinkDestination" : "JE 7/11/2021 17:24",
"applyLinkText" : "JE 7/11/2021 17:24",
"findAndReplaceAll" : "JE 7/11/2021 17:31",
"pluggableTextMorph" : "JE 7/11/2021 16:31",
"pluggableTextMorph:" : "JE 7/11/2021 16:31",
"textSelected" : "JE 7/11/2021 16:57",
"yellowButtonMenu:" : "JE 7/11/2021 16:50" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "MarkdownEditor-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"pluggableTextMorph" ],
"name" : "MarkdownEditorMenu",
"pools" : [
],
"super" : "Object",
"type" : "normal" }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
running
setUp

editor := MarkdownEditor new.
toolbuilder := ToolBuilder default.
window := toolbuilder open: editor
Loading

0 comments on commit 851fa8e

Please sign in to comment.