@windward/core 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Content/Blocks/Accordion.vue +37 -0
- package/components/Content/Blocks/BlockQuote.vue +2 -2
- package/components/Content/Blocks/ClickableIcons.vue +108 -21
- package/components/Content/Blocks/Email.vue +19 -6
- package/components/Content/Blocks/Feedback.vue +12 -5
- package/components/Content/Blocks/Image.vue +47 -19
- package/components/Content/Blocks/OpenResponse.vue +7 -3
- package/components/Content/Blocks/OpenResponseCollate.vue +1 -1
- package/components/Content/Blocks/ScenarioChoice.vue +2 -2
- package/components/Content/Blocks/UserUpload/DisplayUserFilesTable.vue +2 -0
- package/components/Content/Blocks/UserUpload.vue +1 -0
- package/components/Content/Blocks/Video.vue +82 -11
- package/components/Navigation/Items/AskTheExpert.vue +1 -0
- package/components/Settings/AccordionSettings.vue +55 -0
- package/components/Settings/ClickableIconsSettings.vue +89 -8
- package/components/Settings/EmailSettings.vue +6 -10
- package/components/Settings/FeedbackSettings.vue +1 -0
- package/components/Settings/ImageSettings.vue +142 -39
- package/components/Settings/MathSettings.vue +1 -1
- package/components/Settings/OpenResponseSettings.vue +1 -2
- package/components/Settings/ScenarioChoiceSettings.vue +1 -0
- package/components/Settings/TabSettings.vue +7 -1
- package/components/Settings/TextEditorSettings.vue +3 -2
- package/components/Settings/UserUploadSettings.vue +1 -1
- package/components/Settings/VideoSettings.vue +102 -63
- package/components/utils/ContentViewer.vue +6 -1
- package/components/utils/FillInBlank/FillInBlankInput.vue +3 -0
- package/components/utils/MathExpressionEditor.vue +37 -11
- package/components/utils/MathLiveWrapper.vue +47 -25
- package/components/utils/TinyMCEWrapper.vue +214 -34
- package/components/utils/assets/tinymce/content/dark/content.scss +4 -0
- package/components/utils/assets/tinymce/{css/content.scss → content/global.scss} +38 -37
- package/components/utils/assets/tinymce/content/light/content.scss +4 -0
- package/components/utils/assets/tinymce/ui/dark/content.scss +803 -0
- package/components/utils/assets/tinymce/ui/dark/skin.scss +4727 -0
- package/components/utils/assets/tinymce/ui/global.scss +19 -0
- package/components/utils/assets/tinymce/ui/light/content.scss +822 -0
- package/components/utils/assets/tinymce/ui/light/skin.scss +4731 -0
- package/components/utils/glossary/CourseGlossary.vue +3 -1
- package/config/tinymce.config.ts +32 -20
- package/helpers/FillInBlankHelper.ts +34 -28
- package/helpers/GlossaryHelper.ts +90 -73
- package/helpers/MathHelper.ts +108 -28
- package/helpers/tinymce/WindwardPlugins.ts +335 -0
- package/i18n/en-US/components/settings/clickable_icon.ts +2 -0
- package/i18n/en-US/components/settings/image.ts +6 -1
- package/i18n/en-US/components/utils/tiny_mce_wrapper.ts +1 -0
- package/i18n/en-US/shared/settings.ts +3 -0
- package/i18n/es-ES/components/settings/clickable_icon.ts +2 -0
- package/i18n/es-ES/components/settings/image.ts +8 -1
- package/i18n/es-ES/components/utils/tiny_mce_wrapper.ts +1 -0
- package/i18n/es-ES/shared/settings.ts +3 -0
- package/i18n/sv-SE/components/settings/clickable_icon.ts +2 -0
- package/i18n/sv-SE/components/settings/image.ts +6 -1
- package/i18n/sv-SE/components/utils/tiny_mce_wrapper.ts +1 -0
- package/i18n/sv-SE/shared/settings.ts +3 -0
- package/package.json +6 -4
- package/test/Components/Settings/AccordionSettings.spec.js +16 -2
- package/test/__mocks__/contentBlockMock.js +6 -0
- package/test/__mocks__/contentSettingsMock.js +6 -0
- package/test/helpers/MathHelper.spec.js +36 -4
- package/tsconfig.json +4 -0
- package/helpers/tinymce/plugin.ts +0 -208
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
const WindwardPlugins = function (editor: any) {
|
|
2
|
-
let formula: any
|
|
3
|
-
let fillInBlank: any
|
|
4
|
-
// ----- Events ----- //
|
|
5
|
-
editor.ui.registry.addIcon(
|
|
6
|
-
'insertMath',
|
|
7
|
-
'<svg x="0px" y="0px"width="20px" height="20px" viewBox="0 0 445.878 445.878" style="enable-background:new 0 0 445.878 445.878;">' +
|
|
8
|
-
'<path d="M426.024,86.447H209.705l-84.911,298.911c-2.568,7.967-9.854,13.482-18.22,13.771c-0.236,0-0.464,0.006-0.688,0.006 c-8.092,0-15.41-4.924-18.436-12.478l-34.714-86.782H19.851C8.884,299.876,0,290.986,0,280.022 c0-10.965,8.893-19.854,19.851-19.854H66.18c8.109,0,15.421,4.941,18.436,12.483l19.237,48.09l72.472-260.218 c2.639-8.213,10.279-13.781,18.903-13.781h230.798c10.97,0,19.854,8.89,19.854,19.851S436.988,86.447,426.024,86.447z M436.723,353.227l-78.259-87.904l74.576-82.783c1.318-1.454,1.638-3.547,0.857-5.341c-0.804-1.791-2.577-2.946-4.54-2.946h-47.18 c-1.442,0-2.802,0.629-3.759,1.72l-50.059,58.047l-49.674-58.029c-0.939-1.103-2.317-1.738-3.771-1.738h-49.334 c-1.956,0-3.729,1.149-4.521,2.929c-0.81,1.785 0.479,3.875,0.824,5.332l73.743,82.81l-77.641,87.923 c-1.297,1.465-1.605,3.552 0.813,5.325c0.813,1.785,2.586,2.92,4.528,2.92h48.9c1.472,0,2.867-0.65,3.807-1.785l51.819-62.181 l53.05,62.229c0.951,1.11,2.328,1.743,3.782,1.743h49.97c1.962,0,3.735-1.141,4.527-2.926 C438.354,356.779,438.035,354.692,436.723,353.227z"/>' +
|
|
9
|
-
'</svg>'
|
|
10
|
-
)
|
|
11
|
-
editor.addCommand('equation-window', function (data: any) {
|
|
12
|
-
return editor.windowManager.openUrl({
|
|
13
|
-
url: '/plugins/tinymce/math',
|
|
14
|
-
title: 'Equation editor',
|
|
15
|
-
width: window.innerWidth*.50,
|
|
16
|
-
height: window.innerHeight*.75,
|
|
17
|
-
buttons: [
|
|
18
|
-
{
|
|
19
|
-
type: 'cancel',
|
|
20
|
-
text: 'cancel',
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
type: 'custom',
|
|
24
|
-
text: 'submit',
|
|
25
|
-
primary: true,
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
onAction: () => {
|
|
29
|
-
if (data.currentTarget) {
|
|
30
|
-
editor.selection.select(data.currentTarget)
|
|
31
|
-
}
|
|
32
|
-
editor.selection.setContent(
|
|
33
|
-
` <span class='windward-math-content'>` +
|
|
34
|
-
formula +
|
|
35
|
-
`</span>`
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
editor.windowManager.close()
|
|
39
|
-
setOnClickEquationContent(editor)
|
|
40
|
-
},
|
|
41
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
42
|
-
onMessage: (instance: any, message: any) => {
|
|
43
|
-
switch (message.mceAction) {
|
|
44
|
-
case 'equation-insert':
|
|
45
|
-
formula = message.content
|
|
46
|
-
break
|
|
47
|
-
case 'math-plugin-mounted':
|
|
48
|
-
window.postMessage({ latex: data.latex ?? '' }, '*')
|
|
49
|
-
break
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
})
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
editor.ui.registry.addButton('mathButton', {
|
|
56
|
-
icon: 'insertMath',
|
|
57
|
-
onAction: () => {
|
|
58
|
-
editor.execCommand('equation-window', true)
|
|
59
|
-
},
|
|
60
|
-
})
|
|
61
|
-
editor.ui.registry.addMenuItem('math', {
|
|
62
|
-
text: 'Math',
|
|
63
|
-
icon: 'insertMath',
|
|
64
|
-
onAction: () => {
|
|
65
|
-
editor.execCommand('equation-window', true)
|
|
66
|
-
},
|
|
67
|
-
})
|
|
68
|
-
editor.on('init', function () {
|
|
69
|
-
setOnClickEquationContent(editor)
|
|
70
|
-
setOnClickFillInBlank(editor)
|
|
71
|
-
})
|
|
72
|
-
editor.on('SetContent', function () {
|
|
73
|
-
setOnClickEquationContent(editor)
|
|
74
|
-
setOnClickFillInBlank(editor)
|
|
75
|
-
})
|
|
76
|
-
function setOnClickEquationContent(editor: any) {
|
|
77
|
-
const tinymceDoc = editor.getDoc()
|
|
78
|
-
const mqSpan = tinymceDoc.getElementsByClassName(
|
|
79
|
-
'windward-math-content'
|
|
80
|
-
)
|
|
81
|
-
|
|
82
|
-
// Add onclick listener to all equation content
|
|
83
|
-
for (const equationContent of mqSpan) {
|
|
84
|
-
equationContent.contentEditable = 'true'
|
|
85
|
-
if (equationContent.onclick) {
|
|
86
|
-
continue
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
equationContent.onclick = (event: any) => {
|
|
90
|
-
event.stopPropagation()
|
|
91
|
-
editor.execCommand('equation-window', {
|
|
92
|
-
latex: event.target.innerText,
|
|
93
|
-
currentTarget: event.target,
|
|
94
|
-
})
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
editor.addCommand('fib-window', function (data: any) {
|
|
100
|
-
return editor.windowManager.openUrl({
|
|
101
|
-
url: '/plugins/tinymce/FIB',
|
|
102
|
-
title: 'Fill in the blank',
|
|
103
|
-
width: window.innerWidth*.50,
|
|
104
|
-
height: window.innerHeight*.75,
|
|
105
|
-
buttons: [
|
|
106
|
-
{
|
|
107
|
-
type: 'cancel',
|
|
108
|
-
text: 'cancel',
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
type: 'custom',
|
|
112
|
-
text: 'submit',
|
|
113
|
-
primary: true,
|
|
114
|
-
},
|
|
115
|
-
],
|
|
116
|
-
onAction: () => {
|
|
117
|
-
if (data.currentTarget) {
|
|
118
|
-
editor.selection.select(data.currentTarget)
|
|
119
|
-
}
|
|
120
|
-
editor.selection.setContent(
|
|
121
|
-
`<span class='windward-fill-blank' data-feedback =` +
|
|
122
|
-
fillInBlank.feedback +
|
|
123
|
-
` >` +
|
|
124
|
-
fillInBlank.answer +
|
|
125
|
-
`</span>`
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
editor.windowManager.close()
|
|
129
|
-
setOnClickFillInBlank(editor)
|
|
130
|
-
},
|
|
131
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
132
|
-
onMessage: (instance: any, message: any) => {
|
|
133
|
-
switch (message.mceAction) {
|
|
134
|
-
case 'fib-insert':
|
|
135
|
-
fillInBlank = {
|
|
136
|
-
answer: message.content.answer,
|
|
137
|
-
feedback: message.content.feedback,
|
|
138
|
-
}
|
|
139
|
-
break
|
|
140
|
-
case 'fib-plugin-mounted':
|
|
141
|
-
window.parent.postMessage(
|
|
142
|
-
{ answer: data.answer, feedback: data.feedback },
|
|
143
|
-
'*'
|
|
144
|
-
)
|
|
145
|
-
break
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
})
|
|
149
|
-
})
|
|
150
|
-
|
|
151
|
-
editor.ui.registry.addIcon(
|
|
152
|
-
'insertFIB',
|
|
153
|
-
'<svg width="20px" height="20px" viewBox="0 0 24 24"><path d="M17,7H22V17H17V19A1,1 0 0,0 18,20H20V22H17.5C16.95,22 16,21.55 16,21C16,21.55 15.05,22 14.5,22H12V20H14A1,1 0 0,0 15,19V5A1,1 0 0,0 14,4H12V2H14.5C15.05,2 16,2.45 16,3C16,2.45 16.95,2 17.5,2H20V4H18A1,1 0 0,0 17,5V7M2,7H13V9H4V15H13V17H2V7M20,15V9H17V15H20Z" /></svg>'
|
|
154
|
-
)
|
|
155
|
-
|
|
156
|
-
editor.ui.registry.addIcon(
|
|
157
|
-
'glossaryIcon',
|
|
158
|
-
'<svg viewBox="0 0 24 24" width="20px" height="20px" ><path d="M3,15H1V3A2,2 0 0,1 3,1H19V3H3V15M12,23A1,1 0 0,1 11,22V19H7A2,2 0 0,1 5,17V7A2,2 0 0,1 7,5H21A2,2 0 0,1 23,7V17A2,2 0 0,1 21,19H16.9L13.2,22.71C13,22.89 12.76,23 12.5,23H12M9,9V11H19V9H9M9,13V15H17V13H9Z"></path></svg>'
|
|
159
|
-
)
|
|
160
|
-
|
|
161
|
-
/* Add a button that opens a window */
|
|
162
|
-
editor.ui.registry.addButton('glossaryButton', {
|
|
163
|
-
icon: 'glossaryIcon',
|
|
164
|
-
onAction: function () {
|
|
165
|
-
/* apply format */
|
|
166
|
-
editor.formatter.apply('glossary')
|
|
167
|
-
},
|
|
168
|
-
})
|
|
169
|
-
/* Add a button that opens a window */
|
|
170
|
-
editor.ui.registry.addButton('fibButton', {
|
|
171
|
-
icon: 'insertFIB',
|
|
172
|
-
onAction: function () {
|
|
173
|
-
/* Open window */
|
|
174
|
-
editor.execCommand('fib-window', true)
|
|
175
|
-
},
|
|
176
|
-
})
|
|
177
|
-
editor.ui.registry.addMenuItem('FIB', {
|
|
178
|
-
text: 'FIll in the blank',
|
|
179
|
-
icon: 'insertFIB',
|
|
180
|
-
onAction: () => {
|
|
181
|
-
editor.execCommand('fib-window', true)
|
|
182
|
-
},
|
|
183
|
-
})
|
|
184
|
-
|
|
185
|
-
function setOnClickFillInBlank(editor: any) {
|
|
186
|
-
const tinymceDoc = editor.getDoc()
|
|
187
|
-
const mqSpan = tinymceDoc.getElementsByClassName('windward-fill-blank')
|
|
188
|
-
|
|
189
|
-
// Add onclick listener to all equation content
|
|
190
|
-
for (const fib of mqSpan) {
|
|
191
|
-
fib.contentEditable = 'true'
|
|
192
|
-
if (fib.onclick) {
|
|
193
|
-
continue
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
fib.onclick = (event: any) => {
|
|
197
|
-
event.stopPropagation()
|
|
198
|
-
editor.execCommand('fib-window', {
|
|
199
|
-
answer: event.target.innerText,
|
|
200
|
-
feedback: event.target.getAttribute('data-feedback'),
|
|
201
|
-
currentTarget: event.target,
|
|
202
|
-
})
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
export { WindwardPlugins }
|