diff --git a/src/ResourcesLive-GToolkit/RlhOCRElement.class.st b/src/ResourcesLive-GToolkit/RlhOCRElement.class.st index fd6a450..ba79aea 100644 --- a/src/ResourcesLive-GToolkit/RlhOCRElement.class.st +++ b/src/ResourcesLive-GToolkit/RlhOCRElement.class.st @@ -29,10 +29,8 @@ RlhOCRElement >> addShortcuts [ build. shortcut := BlShortcut new combination: keyCombo; - action: [ :anEvent :aShortcut | - self client - write: (desc fromString: self selectedText) - using: desc. ]. + action: [ :anEvent :aShortcut | self applySelectedTextTo: desc ]; + yourself. self addShortcut: shortcut ] ] @@ -57,6 +55,18 @@ RlhOCRElement >> add_hOCR [ self addEventHandler: self selectionHandler ] +{ #category : #accessing } +RlhOCRElement >> applySelectedTextTo: desc [ + "Adaptation of MADescription>>#validate:, which is the main access point to validation i.e. all roads (e.g. mementos, forms) ultimately end up here. We're partially reimplementing instead of sending it ourselves because Magritte does not seem to really be set up to interact with element descriptions individually, but through their containers. In this case, the container supplies the proper validator for the domain object" + + [ self client magritteDescription validator + on: (desc fromString: self selectedText) + description: desc ] + on: MAError + do: [ Halt now. "Try to OCR again based on desc" ]. + self client write: (desc fromString: self selectedText) using: desc +] + { #category : #accessing } RlhOCRElement >> client [ ^ client