Skip to content

Commit 4c82cd8

Browse files
author
Simon Sendler
committed
feat: add prosemirror and wrapper tag
1 parent 19773f3 commit 4c82cd8

File tree

14 files changed

+1364
-1
lines changed

14 files changed

+1364
-1
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<facelet-taglib
3+
version="2.2"
4+
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facelettaglibrary_2_2.xsd">
7+
<namespace>http://goobi.io/editor</namespace>
8+
<tag>
9+
<tag-name>code</tag-name>
10+
<source>editor/code.xhtml</source>
11+
</tag>
12+
<tag>
13+
<tag-name>text</tag-name>
14+
<source>editor/text.xhtml</source>
15+
</tag>
16+
</facelet-taglib>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets">
2+
<ui:insert />
3+
</ui:composition>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<ui:composition
2+
xmlns:ui="http://java.sun.com/jsf/facelets"
3+
xmlns:h="http://xmlns.jcp.org/jsf/html"
4+
xmlns:f="http://xmlns.jcp.org/jsf/core"
5+
xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
6+
>
7+
<f:subview>
8+
<h:panelGroup id="editorSource" style="display: none;" layout="block">
9+
<h:outputText value="#{content}" escape="false"/>
10+
</h:panelGroup>
11+
<h:inputTextarea
12+
style="display: none;"
13+
id="textareaHtml"
14+
value="#{content}" />
15+
<ui:insert />
16+
<h:panelGroup id="editor" layout="block" pt:data-editor="prosemirror" styleClass="editor">
17+
</h:panelGroup>
18+
</f:subview>
19+
<h:outputScript target="head" name="js/dist/prosemirror.js?v=#{HelperForm.buildVersion}" />
20+
</ui:composition>

src/main/webapp/WEB-INF/web.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
/WEB-INF/taglibs/button.taglib.xml;
2626
/WEB-INF/taglibs/dialog.taglib.xml;
2727
/WEB-INF/taglibs/description-list.taglib.xml;
28+
/WEB-INF/taglibs/editor.taglib.xml;
2829
/WEB-INF/taglibs/form.taglib.xml;
2930
/WEB-INF/taglibs/layout.taglib.xml;
3031
/WEB-INF/taglibs/notification.taglib.xml;

src/main/webapp/gulpfile.mjs

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ const sources = {
4747
js: [
4848
'./uii/template/js/**/*.js',
4949
'!./uii/template/js/legacy/**/*',
50+
'!./uii/template/js/editor/**/*.js',
5051
],
52+
editors: [
53+
'uii/template/js/editor/**/*.js',
54+
],
55+
prosemirror: 'uii/template/js/editor/prosemirror.js',
5156
icons: ['node_modules/@tabler/icons/icons/**/*.svg'],
5257
staticAssets: [
5358
'uii/**/*.xhtml',
@@ -195,6 +200,30 @@ function prodJsRollup() {
195200
});
196201
};
197202

203+
function editors() {
204+
return rollup
205+
.rollup({
206+
input: sources.prosemirror,
207+
plugins: [
208+
cleanup(),
209+
nodeResolve(),
210+
],
211+
}).then(bundle => {
212+
return bundle.write({
213+
file: `${customLocation}${targetFolder.js}prosemirror.js`,
214+
format: 'iife',
215+
sourcemap: true,
216+
plugins: [
217+
terser({
218+
mangle: true
219+
}),
220+
]
221+
});
222+
});
223+
// return src(sources.editors)
224+
// .pipe(dest(`${customLocation}${targetFolder.js}`));
225+
}
226+
198227
/*
199228
* preprocess svgs as needed
200229
*/
@@ -231,6 +260,7 @@ function dev() {
231260
loadConfig();
232261
icons();
233262
BsJs();
263+
watch(sources.editors, { ignoreInitial: false }, editors);
234264
watch(sources.legacyJS, { ignoreInitial: false }, jsLegacy);
235265
watch(sources.js, { ignoreInitial: false }, devJsRollup);
236266
watch(sources.bsCss, { ignoreInitial: false }, devBSCss);
@@ -240,6 +270,6 @@ function dev() {
240270
watch(sources.taglibs, { ignoreInitial: false }, taglibs);
241271
watch(sources.includes, { ignoreInitial: false }, includes);
242272
};
243-
const prod = parallel(BsJs,jsLegacy, prodJsRollup, prodBSCss, prodCss, icons,);
273+
const prod = parallel(BsJs,jsLegacy, prodJsRollup, prodBSCss, prodCss, icons, editors,);
244274

245275
export { dev, prod };

src/main/webapp/package-lock.json

Lines changed: 193 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/webapp/package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@
3535
"gulp-svg-sprite": "^2.0.3",
3636
"gulp-svgmin": "^4.1.0",
3737
"gulp-uglify-es": "^3.0.0",
38+
"prosemirror-commands": "^1.7.1",
39+
"prosemirror-dropcursor": "^1.8.2",
40+
"prosemirror-example-setup": "^1.2.3",
41+
"prosemirror-gapcursor": "^1.3.2",
42+
"prosemirror-history": "^1.4.1",
43+
"prosemirror-model": "^1.25.2",
44+
"prosemirror-schema-basic": "^1.2.4",
45+
"prosemirror-schema-list": "^1.5.1",
46+
"prosemirror-state": "^1.4.3",
47+
"prosemirror-view": "^1.40.1",
3848
"rollup": "^4.9.2",
3949
"rollup-plugin-cleanup": "^3.2.1",
4050
"rollup-plugin-scss": "^4.0.0",
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
.editor {
3+
border: 1px solid var(--bs-border-color);
4+
5+
.editor-menubar {
6+
background-color: var(--bs-light);
7+
border-bottom: 1px solid var(--bs-border-color);
8+
padding-block: 0.125rem;
9+
}
10+
11+
.editor-menu-group {
12+
border-inline-end: 1px solid var(--bs-border-color);
13+
display: inline-block;
14+
padding-inline: 0.5rem;
15+
vertical-align: middle;
16+
&:last-of-type {
17+
border-inline-end: none;
18+
}
19+
}
20+
21+
.editor-menuicon {
22+
&.active {
23+
border: 1px solid black;
24+
}
25+
&.inactive {
26+
opacity: 0.5;
27+
}
28+
}
29+
30+
.ProseMirror {
31+
padding: 0.5rem;
32+
}
33+
34+
// styles for HTML elements in the editor
35+
strong {
36+
font-weight: bold;
37+
}
38+
a {
39+
color: var(--clr-primary-600);
40+
text-decoration: underline;
41+
}
42+
}

0 commit comments

Comments
 (0)