Route::match(['get'], $segment . '/{id}/edit/markdown/versions/restore/{version}', $controller . '@restoreMarkdowns');
Route::match(['get'], $segment . '/{id}/markdown', $controller . '@getFilesById');
Route::match(['put'], $segment . '/{id}/save/markdown', $controller . '@saveMarkdown');
+ Route::match(['get'], $segment . '/{id}/import/markdown', $controller . '@importMarkdown');
}
public function markdown($id)
return response()->json(['success' => 'ok']);
}
+
+ public function importMarkdown($fluidbook_id)
+ {
+ $fluidbook = FluidbookPublication::withoutGlobalScopes()->find($fluidbook_id);
+ $base = Files::mkdir($fluidbook->protected_path('fluidbookpublication/accessible/' . $fluidbook_id . '/'));
+ $file = $base . 'latest.accessible.gz';
+ $meta = $base . 'latest.meta.gz';
+ Files::rmdir($file);
+ Files::rmdir($meta);
+ $md = $fluidbook->getAccessibleContents();
+
+ $message = "Markdown importé";
+
+ $this->saveMarkdown($fluidbook_id, $message, $md['pages']);
+
+ return response()->json(['success' => $md['pages']]);
+ }
}
this.mx = e.pageX;
this.my = e.pageY;
},
+
+ importMarkdown: function() {
+ $.ajax({
+ url: '/fluidbook-publication/' + FLUIDBOOK_DATA.id + '/import/markdown/',
+ success: function (data) {
+ window.location.reload();
+ },
+ });
+ }
}
<line class="st0" x1="28.9" y1="10.6" x2="24.3" y2="12.6"/>
<line class="st0" x1="25.9" y1="6.1" x2="22.4" y2="9.6"/>
<line class="st0" x1="21.4" y1="3.1" x2="19.4" y2="7.7"/>
- </symbol></svg></div>
+ </symbol><symbol id="linkeditor-import-markdown" viewBox="0 0 19.97 19.91"><path d="m.45 0-.23.02-.04.13c-.06.19-.1 2.2-.1 5.07 0 2.54.04 4.1.11 4.25.07.14.2.18.57.18.42 0 .57-.05.65-.23.05-.11.06-.34.07-1.76v-1.64s.47-.02.47-.02c.7-.03 1.4-.21 1.83-.46.28-.16.71-.6.83-.85.22-.43.3-.82.33-1.48.06-1.26-.29-2.13-1.07-2.69-.35-.25-.79-.45-1.06-.48-.33-.03-2.06-.06-2.36-.04m5.69.05c-.11.14-.12.28-.14 2.04-.01.97-.03 3.02-.03 4.56v2.79s.16.12.16.12c.25.18.4.22.93.24.78.03 1.73-.09 2.2-.26.65-.24 1.22-.88 1.45-1.61.12-.41.15-.98.15-3.07 0-2.24-.03-2.66-.18-3.13-.15-.44-.29-.67-.6-.97-.23-.22-.34-.3-.63-.44-.19-.09-.41-.19-.48-.21-.3-.09-2.75-.14-2.81-.06m6.25-.01c-.18.03-.23.08-.26.29-.04.24-.07 7.4-.03 8.24.05 1.05.05 1.06.57 1.1.31.02.48-.02.66-.17l.14-.12v-3.95h1.06c1.26-.03 1.27-.03 1.36-.31.06-.22.06-.33 0-.48-.09-.23-.3-.26-1.64-.3l-.77-.02v-3.11h.94c1.26 0 1.91-.04 2.02-.13.13-.1.18-.23.18-.51s-.05-.48-.14-.52c-.07-.03-3.87-.05-4.09-.02m-10.04 1.27c.44.07.82.33.99.66.08.16.08.19.1 1.02l.02.86-.11.2c-.22.41-.41.56-.86.68-.14.04-.44.08-.65.09l-.39.02v-3.62l.33.02c.18.01.44.04.58.07m5.81-.01c.45.06.77.27 1.05.69l.17.26-.02 2.53c-.01 2.52-.01 2.54-.09 2.75-.22.64-.71.9-1.69.9h-.24v-7.22l.29.02c.16.01.4.04.52.05m-7.7 9.56c-.15.07-.36.27-.43.4-.1.22-.05.88.13 1.5.29 1.03 1.11 2.01 2.07 2.47.37.18.64.27.94.32.28.04 1.41.1 2.26.1.35 0 .73.01.85.03l.22.02-.49.52c-.57.6-.78.86-.81 1-.06.28.11.59.39.72q.39.18 1.96-1.38c.85-.85 1.35-1.37 1.39-1.46.09-.17.09-.31 0-.47-.12-.23-1.89-2.05-2.52-2.58-.34-.29-.48-.36-.65-.34-.26.05-.56.32-.61.57-.05.23.14.49 1.02 1.39l.48.5-1.57-.02c-.86-.01-1.65-.04-1.75-.05-.38-.07-.92-.42-1.29-.84-.27-.31-.42-.64-.56-1.28-.19-.88-.22-.93-.48-1.07-.15-.08-.43-.1-.56-.04" fill-rule="evenodd" fill="currentColor"/><path fill="currentColor" d="m14.12 17.19-.95-3.78v4.09c0 .23-.05.4-.15.51s-.24.17-.4.17-.29-.06-.4-.17c-.1-.11-.15-.28-.15-.51v-4.69c0-.26.07-.43.2-.52s.32-.14.55-.14h.37c.22 0 .39.02.49.06s.18.11.22.22c.05.11.1.28.17.51l.86 3.25.86-3.25c.06-.24.12-.41.17-.51s.12-.18.22-.22.26-.06.49-.06h.37c.23 0 .41.04.54.14.13.09.2.26.2.52v4.69c0 .23-.05.4-.15.51s-.24.17-.41.17c-.16 0-.29-.06-.39-.17s-.15-.28-.15-.51v-4.09l-.95 3.78c-.06.25-.11.42-.15.54-.04.11-.11.22-.22.31s-.25.14-.44.14c-.14 0-.26-.03-.36-.09s-.17-.14-.23-.23c-.05-.09-.1-.2-.13-.31s-.06-.23-.09-.36z"/><rect fill="none" height="8.8" rx="1.03" stroke="currentColor" stroke-miterlimit="10" stroke-width=".5" width="9.76" x="9.97" y="10.85"/></symbol></svg></div>
<script>
function getSpriteIcon(icon, attrs, dimensions) {
var a = [];
<a href="#" data-action="lastPage" data-icon="last-page"
data-tooltip="{{__('Aller à la dernière page')}}"></a>
<div class="separator"></div>
+ <a href="#" data-action="importMarkdown" data-icon="import-markdown"
+ data-tooltip="{{__('Importer le markdown')}}"></a>
<a href="#" data-action="openFluidbook" data-icon="open-fluidbook"
data-tooltip="{{__('Ouvrir le fluidbook à la page courante')}}"></a>
</nav>