diff --git a/src/cljc/daisyproducer2/i18n.cljc b/src/cljc/daisyproducer2/i18n.cljc index 5b27008..cf2c362 100644 --- a/src/cljc/daisyproducer2/i18n.cljc +++ b/src/cljc/daisyproducer2/i18n.cljc @@ -114,6 +114,7 @@ :epub3 "EPUB3" :online-player "Online Player" :open-document "Open Document" + :html "HTML" ;; Download Forms :grade {:g0 "Uncontracted" @@ -312,6 +313,7 @@ :epub3 "EPUB3" :online-player "Online Player" :open-document "Open Document" + :html "HTML" ;; Download Forms :grade {:g0 "Basisschrift" diff --git a/src/cljs/daisyproducer2/core.cljs b/src/cljs/daisyproducer2/core.cljs index 38d38b3..ec0777c 100644 --- a/src/cljs/daisyproducer2/core.cljs +++ b/src/cljs/daisyproducer2/core.cljs @@ -95,6 +95,8 @@ :controllers [{:parameters {:path [:id]}}]}] ["/preview/open-document" {:name :document-preview-open-document :view #'document/preview-open-document :controllers [{:parameters {:path [:id]}}]}] + ["/preview/html" {:name :document-preview-html :view #'document/preview-html + :controllers [{:parameters {:path [:id]}}]}] ["/markup" {:name :document-markup :view #'document/markup :controllers [{:parameters {:path [:id]}}]}] ["/versions" {:name :document-versions :view #'document/versions diff --git a/src/cljs/daisyproducer2/documents/document.cljs b/src/cljs/daisyproducer2/documents/document.cljs index b08b9a1..3ae336f 100644 --- a/src/cljs/daisyproducer2/documents/document.cljs +++ b/src/cljs/daisyproducer2/documents/document.cljs @@ -82,7 +82,7 @@ :document-preview-large-print-library :document-preview-large-print-sale :document-preview-large-print-configurable :document-preview-epub :document-preview-epub-in-player - :document-preview-open-document}] + :document-preview-open-document :document-preview-html}] ;; only show the unknown and local words for German books (when german? [tab-link-with-total (str "#/documents/" id "/unknown") (tr [:unknown-words]) :document-unknown [::unknown/words-total] @@ -203,6 +203,13 @@ [tabs document] [forms/open-document document]])) +(defn preview-html [] + (let [document @(rf/subscribe [::current])] + [:section.section>div.container>div.content + [summary document] + [tabs document] + [forms/html document]])) + (defn markup [] (let [document @(rf/subscribe [::current])] [:section.section>div.container>div.content diff --git a/src/cljs/daisyproducer2/documents/preview.cljs b/src/cljs/daisyproducer2/documents/preview.cljs index a27fcf9..9b86170 100644 --- a/src/cljs/daisyproducer2/documents/preview.cljs +++ b/src/cljs/daisyproducer2/documents/preview.cljs @@ -42,6 +42,13 @@ {:href (str "#/documents/" id "/preview/open-document")} [:span (tr [:preview])]]]]) +(defn- html-buttons [id] + [:div.field + [:p.control + [:a.button + {:href (str "#/documents/" id "/preview/html")} + [:span (tr [:preview])]]]]) + (defn preview-links [{id :id}] [:div.block [:table.table.is-fullwidth @@ -53,6 +60,7 @@ [:tr [:th (tr [:braille])] [:td [braille-buttons id]]] [:tr [:th (tr [:large-print])] [:td [large-print-buttons id]]] [:tr [:th (tr [:epub3])] [:td [epub-buttons id]]] - [:tr [:th (tr [:open-document])] [:td [open-document-buttons id]]]]]]) + [:tr [:th (tr [:open-document])] [:td [open-document-buttons id]]] + [:tr [:th (tr [:html])] [:td [html-buttons id]]]]]]) diff --git a/src/cljs/daisyproducer2/documents/preview/forms.cljs b/src/cljs/daisyproducer2/documents/preview/forms.cljs index 747f234..afc98d1 100644 --- a/src/cljs/daisyproducer2/documents/preview/forms.cljs +++ b/src/cljs/daisyproducer2/documents/preview/forms.cljs @@ -322,3 +322,17 @@ (checkbox props {:name :floating-page-numbers :text (tr [:forms/floating-page-numbers])}) (input props {:name :answer-markup :label (tr [:forms/answer-markup]) :type "text"}) (submit-button props {:name :submit :label (tr [:preview])})]))]) + +(defn html [{id :id}] + [fork/form {:initial-values {} + :path [:form :html] + :prevent-default? true + :clean-on-unmount? true + :on-submit #(rf/dispatch [::submit-handler :html id %]) + :keywordize-keys true + } + (fn [{:keys [path form-id on-submit-server-message handle-submit] :as props}] + (if on-submit-server-message + [error-notification on-submit-server-message path] + [:form {:id form-id :on-submit handle-submit} + (submit-button props {:name :submit :label (tr [:preview])})]))])