Skip to content

Commit fb09beb

Browse files
author
Chris Hart
committed
Make TinyMCE cellpadding and cellspacing work
Fixes: CNVS-19489 Test plan: - In TinyMCE, make 2 tables: one with cellpadding and cellspacing, and one without. Give both tables a border value, so you can see their dimensions. - When you save your content, you should see that the cellpadding and cellspacing values are now being respected in published content. - Note: this commit fixes everything except the use case where the user creates a table inside a parent table. Only tables that are direct children of the .user_content container were possible to target with this fix. Change-Id: I28b589f38167549e1a4a046327f08fcaed08a3cc Reviewed-on: https://gerrit.instructure.com/72715 Tested-by: Jenkins Reviewed-by: Colleen Palmer <colleen@instructure.com> Product-Review: Colleen Palmer <colleen@instructure.com> QA-Review: Myller de Araujo <myller@instructure.com>
1 parent 991bc5f commit fb09beb

3 files changed

Lines changed: 18 additions & 12 deletions

File tree

app/stylesheets/components/_g_instructure.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
margin-top: 1em;
150150
margin-bottom: 1em;
151151
}
152-
table {
152+
table:not([cellpadding]) {
153153
margin-left: 5px;
154154
td {
155155
padding: 2px;

app/stylesheets/components/_tables.scss

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,23 @@ Enclose our standard Cog Dropdown within a **div class="ic-Table--actions** to r
222222
223223
*/
224224

225+
// Base table styles for Canvas
226+
table {
227+
max-width: 100%;
228+
background-color: $tableBackground;
229+
}
230+
231+
// Need to completely hide the border-collapse and
232+
// border-spacing defaults from TinyMCE so the
233+
// user-defined cellspacing attribute still works.
234+
:not(.user_content) > table,
235+
// However, for tables without cellspacing, we do
236+
// want to include the defaults.
237+
.user_content table:not([cellspacing]) {
238+
border-collapse: collapse;
239+
border-spacing: 0;
240+
}
241+
225242
$sp-table: 14px; // Will replace this with global spacing variable, when it hits master
226243

227244
//ic-Tab__Panel--is-open

app/stylesheets/vendor/bootstrap/_tables.scss

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,6 @@
22
// Tables
33
// --------------------------------------------------
44

5-
6-
// BASE TABLES
7-
// -----------------
8-
9-
table {
10-
max-width: 100%;
11-
background-color: $tableBackground;
12-
border-collapse: collapse;
13-
border-spacing: 0;
14-
}
15-
165
// BASELINE STYLES
176
// ---------------
187

0 commit comments

Comments
 (0)