-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(server): mimic frontend CSS in ckeditor editor (#616)
- Loading branch information
Showing
5 changed files
with
102 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
...els-backends/judgels-server-app/src/main/resources/judgels/michael/resource/ckeditor-2.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
document.addEventListener('DOMContentLoaded', function() { | ||
CKEDITOR.config.toolbar = [ | ||
['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat'], | ||
['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote'], | ||
['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], | ||
['Image', 'Link', 'Table'], | ||
['Styles', 'Format'], | ||
['Source', '-', 'Preview'] | ||
]; | ||
CKEDITOR.config.allowedContent = { | ||
$1: { | ||
// Use the ability to specify elements as an object. | ||
elements: CKEDITOR.dtd, | ||
attributes: true, | ||
styles: true, | ||
classes: true | ||
} | ||
}; | ||
CKEDITOR.config.height = 600; | ||
CKEDITOR.config.extraAllowedContent = 'iframe embed'; | ||
CKEDITOR.config.disallowedContent = 'script; *[on*]'; | ||
CKEDITOR.config.removePlugins = 'exportpdf'; | ||
CKEDITOR.addCss(` | ||
.cke_editable { | ||
font-size: 14px; | ||
color: #1c2127; | ||
} | ||
h3 { | ||
font-family: 'Roboto', sans-serif; | ||
font-size: 17px; | ||
font-weight: bold; | ||
margin-top: 20px; | ||
margin-bottom: 10px; | ||
} | ||
h4 { | ||
font-family: 'Roboto', sans-serif; | ||
font-size: 15px; | ||
font-weight: bold; | ||
margin-top: 10px; | ||
margin-bottom: 10px; | ||
} | ||
pre { | ||
padding: 9.5px; | ||
margin: 0 0 10px; | ||
border: 1px solid #ccc; | ||
border-radius: 4px; | ||
} | ||
pre, code { | ||
background-color: #f5f5f5; | ||
} | ||
code { | ||
padding: 2px 4px; | ||
border-radius: 4px; | ||
font-size: 90%; | ||
} | ||
ul, ol { | ||
padding-left: 25px; | ||
} | ||
table { | ||
border-collapse: collapse; | ||
} | ||
th { | ||
font-weight: bold; | ||
background-color: #eeeeee; | ||
text-align: left; | ||
} | ||
th, td { | ||
padding: 5px; | ||
} | ||
blockquote { | ||
padding: 10px 20px; | ||
margin: 0 0 20px; | ||
border-left: 5px solid #eee; | ||
font-style: normal; | ||
} | ||
`); | ||
}, false); |
2 changes: 1 addition & 1 deletion
2
judgels-backends/judgels-server-app/src/main/resources/judgels/michael/resource/ckeditor.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
<script src="/webjars/ckeditor/full/ckeditor.js"></script> | ||
<script><#include "ckeditor.js"></script> | ||
<script><#include "ckeditor-2.js"></script> |
23 changes: 0 additions & 23 deletions
23
judgels-backends/judgels-server-app/src/main/resources/judgels/michael/resource/ckeditor.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters