Skip to content

Commit a01c5f6

Browse files
committed
style code moved to custom element
1 parent 1104ebd commit a01c5f6

File tree

6 files changed

+15707
-12104
lines changed

6 files changed

+15707
-12104
lines changed

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/pre-commit

Lines changed: 0 additions & 4 deletions
This file was deleted.

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"danger-plugin-no-console": "1.1.2",
7676
"gulp": "^4.0.2",
7777
"gulp-sourcemaps": "^3.0.0",
78-
"husky": "^7.0.0",
78+
"husky": "^7.0.4",
7979
"lint-staged": "^13.0.0",
8080
"nodemon": "2.0.7",
8181
"pinst": "2.1.4",

webplugin/js/app/components/custom-element.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,31 @@ class ShadowDomComponent extends HTMLElement {
22
constructor() {
33
super();
44
this._shadow = this.attachShadow({ mode: 'open' });
5+
6+
const style = document.createElement('style');
7+
style.textContent = `
8+
table {
9+
border-collapse: separate;
10+
border-spacing: 0;
11+
background-color: #EFEFEF;
12+
overflow: hidden;
13+
border: 1px solid #D0D5DD;
14+
border-radius: 15px;
15+
font-weight: 300;
16+
color: #535862;
17+
}
18+
td {
19+
padding: 15px;
20+
border: 1px solid #D0D5DD;
21+
text-align: center;
22+
}
23+
`;
24+
this._shadow.appendChild(style);
525
}
626
}
727

8-
// Define the custom element
928
if ('customElements' in window) {
1029
if (!window.customElements.get('mck-html-rich-message')) {
1130
window.customElements.define('mck-html-rich-message', ShadowDomComponent);
1231
}
13-
}
32+
}

webplugin/js/app/mck-sidebox-1.0.js

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8756,28 +8756,7 @@ const firstVisibleMsg = {
87568756
KommunicateUtils.customElementSupported()
87578757
) {
87588758
const kmElement = document.createElement('mck-html-rich-message');
8759-
kmElement._shadow.innerHTML = emoji_template;
8760-
if (kmElement && kmElement.shadowRoot) {
8761-
const style = document.createElement('style');
8762-
style.textContent = `
8763-
table {
8764-
border-collapse: separate;
8765-
border-spacing: 0;
8766-
background-color: #EFEFEF;
8767-
overflow: hidden;
8768-
border: 1px solid #D0D5DD;
8769-
border-radius: 15px;
8770-
font-weight: 300;
8771-
color: #535862;
8772-
}
8773-
td {
8774-
padding: 15px;
8775-
border: 1px solid #D0D5DD;
8776-
text-align: center;
8777-
}
8778-
`;
8779-
kmElement.shadowRoot.appendChild(style);
8780-
}
8759+
kmElement._shadow.innerHTML += emoji_template;
87818760
$textMessage.append(kmElement);
87828761

87838762
htmlRichMessage = true;

0 commit comments

Comments
 (0)