protected function getPageText($fluidbook_id, $type, $page)
{
- $types = ['texts' => FluidbookDocument::TEXT_PLAIN, 'index' => FluidbookDocument::TEXT_INDEX];
+ $types = ['texts' => FluidbookDocument::TEXT_PLAIN, 'index' => FluidbookDocument::TEXT_INDEX, 'layout' => FluidbookDocument::TEXT_LAYOUT];
if (!isset($types[$type])) {
abort(404, 'Text type not found');
}
abort(401);
}
/** @var FluidbookPublication $fb */
- $fb = FluidbookPublication::find($fluidbook_id);
- $document = $fb->getDocument($page);
- $path = $document->getTextFile($page, $types[$type], $fb->textExtraction, $fb->ignoreSearchSeparators);
- return response(Gzip::file_get_contents($path), 200, ['content-type' => 'text/plain']);
+ $fb = FluidbookPublication::withoutGlobalScopes()->find($fluidbook_id);
+ $contentType = 'text/plain';
+ if ($type == FluidbookDocument::TEXT_LAYOUT) {
+ $path = $fb->getHightlightFile($page);
+ $contentType = 'application/json';
+ } else {
+ $path = $fb->getTextFile($page, $types[$type]);
+ }
+ return response(Gzip::file_get_contents($path), 200, ['content-type' => $contentType]);
}
callback: function (key, opt) {
window.open('/fluidbook-publication/' + {{$entry->id}} + '/index/' + ($(opt.$trigger[0]).index() + 1) + '.txt');
},
+ },
+ seelayout: {
+ name: "{{__('Informations pour le surlignage')}}",
+ callback: function (key, opt) {
+ window.open('/fluidbook-publication/' + {{$entry->id}} + '/layout/' + ($(opt.$trigger[0]).index() + 1) + '.txt');
+ },
}
}
}