The new button-on-image UI can now be enabled on Beta Wikisource, for easier testing.
Description
Details
Related Objects
Event Timeline
Change 685643 had a related patch set uploaded (by Samwilson; author: Samwilson):
[operations/mediawiki-config@master] Enable Wikimedia OCR on Beta Wikisource
Change 685643 merged by jenkins-bot:
[operations/mediawiki-config@master] Enable Wikimedia OCR on Beta Wikisource
It's deployed (demo) but there's a CSP error:
Content Security Policy: The page’s settings blocked the loading of a resource at https://ocr-test.wmcloud.org/api.php?engine=tesseract&langs[]=&image=https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2Fthumb%2Fb%2Fbd%2FWar_and_Peace.djvu%2Fpage13-1024px-War_and_Peace.djvu.jpg&uselang=en (“default-src”).
I'm guessing we have to add $out->getCSP()->addDefaultSrc( $this->toolUrl ); to \MediaWiki\Extension\Wikisource\HookHandler\EditPageShowEditFormInitialHandler.
Change 688590 had a related patch set uploaded (by Samwilson; author: Samwilson):
[mediawiki/extensions/Wikisource@master] Add OCR tool URL as a CSP default-src
Change 688590 merged by jenkins-bot:
[mediawiki/extensions/Wikisource@master] Add OCR tool URL as a CSP default-src
I have experimented with a number of books on beta in different languages. For example:
- https://en.wikisource.beta.wmflabs.org/w/index.php?title=Page:Wind_in_the_Willows_(1913).djvu/24&action=edit
- https://en.wikisource.beta.wmflabs.org/w/index.php?title=Page:%D0%A1%D0%BB%D0%BE%D0%B2%D0%B0%D1%80%D1%8C_%D0%94%D0%B0%D0%BB%D1%8F_1865-2.djvu/1&action=edit
- https://en.wikisource.beta.wmflabs.org/w/index.php?title=Page:%E0%A4%B9%E0%A4%BF%E0%A4%A8%E0%A5%8D%E0%A4%A6%E0%A5%80_%E0%A4%B5%E0%A4%BF%E0%A4%B6%E0%A5%8D%E0%A4%B5%E0%A4%95%E0%A5%8B%E0%A4%B7_%E0%A4%8F%E0%A4%95%E0%A4%B5%E0%A4%BF%E0%A4%82%E0%A4%B6_%E0%A4%AD%E0%A4%BE%E0%A4%97.djvu/1&action=edit
- https://en.wikisource.beta.wmflabs.org/w/index.php?title=Page:Algebraic_relations_between_certain_infinite_products.djvu/1&action=edit
(It does not seem to matter whether or not you are logged in).
Note that on smaller screens you might find the "Extract text" button obscures some of the text on an image. I don't think this matters because the images are "slippy" and you can move them around freely (and zoom in and out).
If you click the OCR button it will overwrite any text in the edit box. If you have made edits (but not published them) you could lose them without warning. I don't know if we can check if there are any unsaved changes and warn people when they click the OCR button.
I have not been able to test error handling. I will try to think about how I can do this, and come back to it.
I mostly tested on Firefox 78, but also briefly on IE11, Safari 14 and Safari 12.
Test Environment:
- Wikisource: https://en.wikisource.beta.wmflabs.org Wikisource – (292e0c4) 00:31, 13 May 2021
- Wikimedia OCR: https://ocr-test.wmcloud.org Version 0.2.0-2-g5ea6c51
One way to get an error could come from sending an overly-large image to Google, e.g. https://en.wikisource.beta.wmflabs.org/w/index.php?title=Page:Nippon_Times_1945-10-08_p1.jpg&action=edit&redlink=1 (I've changed the 'width' parameter in the Index page to 3000px). Although, I'm not sure what Google's limit is these days; it used to be quite small.