Improving HedgeDoc page importation.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2024-03-26 12:53:55 -05:00
parent e7f2910a51
commit aec4b58e23
3 changed files with 9 additions and 5 deletions

View File

@ -16,6 +16,11 @@ Class {
#category : #'MiniDocs-Core'
}
{ #category : #accessing }
HedgeDoc class >> fromLink: aUrl [
^ self new fromLink: aUrl
]
{ #category : #'as yet unclassified' }
HedgeDoc class >> newDefault [
^ self new

View File

@ -37,14 +37,13 @@ LeHomeDatabaseHeaderElement >> initializeButtons [
{ #category : #'*MiniDocs' }
LeHomeDatabaseHeaderElement >> initializeMiniDocsImportButton [
"importMinidocsButtonElement := self newImportMiniDocsButton."
self userData at: 'importMinidocsButtonElement' put: self newImportMiniDocsButton.
]
{ #category : #'*MiniDocs' }
LeHomeDatabaseHeaderElement >> newImportMiniDocsButton [
^ LeMiniDocsImport new
tooltip: 'Import MiniDocs from url';
tooltip: 'Import document from link';
contentExtent: 200 @ 30
]

View File

@ -39,7 +39,7 @@ LeMiniDocsImport >> createURLeditable [
yourself.
editable := BrEditableLabel new
aptitude: BrGlamorousEditableLabelAptitude new glamorousRegularFontAndSize;
text: 'Hedgedoc url';
text: 'Document link';
switchToEditor.
editable when: BrEditorAcceptWish do: [ :aWish |
self importHedgedoc: aWish text asString.
@ -56,9 +56,9 @@ LeMiniDocsImport >> database: aLeDatabase [
{ #category : #accessing }
LeMiniDocsImport >> importHedgedoc: aURL [
| doc text page |
doc := HedgeDoc new url: aURL asString.
doc := HedgeDoc fromLink: aURL asString.
text := doc retrieveContents; contents.
page := LePage named: (doc metadata at: 'title').
page := LePage named: (doc title).
page addSnippet: (LeTextSnippet string: text).
^ database addPage: page
]