Prototyping copying pages. Snippets' order is preserved, but not (yet) hierarchy.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2023-10-12 17:01:26 -05:00
parent 0a802799b2
commit 8488531726
2 changed files with 27 additions and 0 deletions

View File

@ -1,5 +1,23 @@
Extension { #name : #LeDatabase } Extension { #name : #LeDatabase }
{ #category : #'*MiniDocs' }
LeDatabase >> addPageCopy: aLePage [
| page |
page := LePage new.
page title: ('Copy of ', aLePage title,' (id: ', (page uid asString copyFrom: 1 to: 8), ')').
aLePage children do: [ :snippet | | newSnippet |
newSnippet := snippet class new.
newSnippet className = 'LeTextSnippet' ifTrue: [ newSnippet
string: snippet contentAsString ].
newSnippet className = 'LePharoSnippet' ifTrue: [ newSnippet code: snippet contentAsString ].
newSnippet uid: LeUID new.
page addSnippet: newSnippet.
newSnippet database: self.
self registerSnippet: newSnippet ].
self addPage: page.
^ page
]
{ #category : #'*MiniDocs' } { #category : #'*MiniDocs' }
LeDatabase >> addPageFromMarkdeep: markdeepDocTree withRemote: externalDocLocation [ LeDatabase >> addPageFromMarkdeep: markdeepDocTree withRemote: externalDocLocation [
| remoteMetadata divSnippets snippets page | | remoteMetadata divSnippets snippets page |

View File

@ -224,6 +224,15 @@ LePage >> storage [
^ self optionAt: 'storage' ^ self optionAt: 'storage'
] ]
{ #category : #'*MiniDocs' }
LePage >> uiAddCopyButtonFor: anAction [
<lePageAction>
^ anAction button
tooltip: 'Export Page';
icon: BrGlamorousVectorIcons changes;
action: [:aButton | aButton phlow spawnObject: (self page database addPageCopy: self page) ]
]
{ #category : #'*MiniDocs' } { #category : #'*MiniDocs' }
LePage >> uiDefineFolderFor: anAction [ LePage >> uiDefineFolderFor: anAction [
<lePageAction> <lePageAction>