diff --git a/src/class/container.js b/src/class/container.js
index be0980d9c9..9551188c26 100644
--- a/src/class/container.js
+++ b/src/class/container.js
@@ -76,7 +76,7 @@ Entry.Container = class Container {
.bindOnClick(() => {
Entry.dispatchEvent('openSpriteManager');
});
- addButton.innerHTML = Lang.Workspace.add_object;
+ addButton.textContent = Lang.Workspace.add_object;
const ulWrapper = Entry.createElement('div');
this._view.appendChild(ulWrapper);
diff --git a/src/class/engine.js b/src/class/engine.js
index 49b482c849..5135110468 100644
--- a/src/class/engine.js
+++ b/src/class/engine.js
@@ -141,7 +141,7 @@ Entry.Engine = class Engine {
this.blur();
})
.appendTo(this.buttonWrapper);
- this.addButton.innerHTML = Lang.Workspace.add_object;
+ this.addButton.textContent = Lang.Workspace.add_object;
if (!Entry.objectAddable) {
this.addButton.addClass('entryRemove');
}
@@ -151,7 +151,7 @@ Entry.Engine = class Engine {
.addClass('entryRunButtonWorkspace_w')
.bindOnClick(() => Entry.do('toggleRun', 'runButton'))
.appendTo(this.buttonWrapper);
- this.runButton.innerHTML = Lang.Workspace.run;
+ this.runButton.textContent = Lang.Workspace.run;
this.runButton2 = Entry.createElement('button')
.addClass('entryEngineButtonWorkspace_w')
@@ -185,7 +185,7 @@ Entry.Engine = class Engine {
.addClass('entryRemove')
.bindOnClick(() => Entry.do('toggleStop', 'stopButton'))
.appendTo(this.buttonWrapper);
- this.stopButton.innerHTML = Lang.Workspace.stop;
+ this.stopButton.textContent = Lang.Workspace.stop;
this.stopButton2 = Entry.createElement('button')
.addClass('entryEngineButtonWorkspace_w')
@@ -196,7 +196,7 @@ Entry.Engine = class Engine {
Entry.engine.toggleStop();
})
.appendTo(this.buttonWrapper);
- this.stopButton2.innerHTML = Lang.Workspace.stop;
+ this.stopButton2.textContent = Lang.Workspace.stop;
} else if (option == 'minimize') {
/** @type {!Element} */
this.view_ = controlView;
@@ -228,7 +228,7 @@ Entry.Engine = class Engine {
this.stopButton.addClass('entryEngineButtonMinimize');
this.stopButton.addClass('entryStopButtonMinimize');
this.stopButton.addClass('entryRemove');
- this.stopButton.innerHTML = Lang.Workspace.stop;
+ this.stopButton.textContent = Lang.Workspace.stop;
this.view_.appendChild(this.stopButton);
this.stopButton.bindOnClick(function(e) {
this.blur();
@@ -236,7 +236,7 @@ Entry.Engine = class Engine {
});
this.pauseButton = Entry.createElement('button');
- this.pauseButton.innerHTML = Lang.Workspace.pause;
+ this.pauseButton.textContent = Lang.Workspace.pause;
this.pauseButton.addClass('entryEngineButtonMinimize');
this.pauseButton.addClass('entryPauseButtonMinimize');
this.pauseButton.addClass('entryRemove');
@@ -314,7 +314,7 @@ Entry.Engine = class Engine {
if (Entry.objectAddable) {
this.runButton.addClass('small');
}
- this.runButton.innerHTML = Lang.Workspace.run;
+ this.runButton.textContent = Lang.Workspace.run;
this.footerView_.appendChild(this.runButton);
this.runButton.bindOnClick((e) => {
@@ -330,7 +330,7 @@ Entry.Engine = class Engine {
if (Entry.objectAddable) {
this.stopButton.addClass('small');
}
- this.stopButton.innerHTML = Lang.Workspace.stop;
+ this.stopButton.textContent = Lang.Workspace.stop;
this.footerView_.appendChild(this.stopButton);
this.stopButton.bindOnClick((e) => {
@@ -368,7 +368,7 @@ Entry.Engine = class Engine {
const audioShadeText = Entry.createElement('div', 'audioShadeText').addClass(
'audioShadeText'
);
- audioShadeText.innerHTML = Lang.Msgs.ai_utilize_audio_listening;
+ audioShadeText.textContent = Lang.Msgs.ai_utilize_audio_listening;
this.audioShadePanel_.appendChild(audioShadeText);
this.minimizedView_ = document.querySelector('#entryCanvasWrapper');
if (this.view_.classList[0] === 'entryEngine') {
@@ -490,7 +490,7 @@ Entry.Engine = class Engine {
this.view_.insertBefore(speedBox, Entry.stage.canvas.canvas);
this.speedLabel_ = Entry.createElement('div', 'entrySpeedLabelWorkspace');
- this.speedLabel_.innerHTML = Lang.Workspace.speed;
+ this.speedLabel_.textContent = Lang.Workspace.speed;
speedBox.appendChild(this.speedLabel_);
this.speedProgress_ = Entry.createElement('table', 'entrySpeedProgressWorkspace');
@@ -855,14 +855,14 @@ Entry.Engine = class Engine {
setPauseButton() {
if (this.state === EntryEngineState.pause) {
if (this.pauseButton) {
- this.pauseButton.innerHTML = Lang.Workspace.restart;
+ this.pauseButton.textContent = Lang.Workspace.restart;
if (this.option !== 'minimize') {
this.pauseButton.removeClass('entryPauseButtonWorkspace_w');
this.pauseButton.addClass('entryRestartButtonWorkspace_w');
}
}
if (this.pauseButtonFull) {
- this.pauseButtonFull.innerHTML = Lang.Workspace.restart;
+ this.pauseButtonFull.textContent = Lang.Workspace.restart;
if (this.option !== 'minimize') {
// workspace && buttonWrapper check
if (this.buttonWrapper) {
@@ -875,14 +875,14 @@ Entry.Engine = class Engine {
}
} else {
if (this.pauseButton) {
- this.pauseButton.innerHTML = Lang.Workspace.pause;
+ this.pauseButton.textContent = Lang.Workspace.pause;
if (this.option !== 'minimize') {
this.pauseButton.addClass('entryPauseButtonWorkspace_w');
this.pauseButton.removeClass('entryRestartButtonWorkspace_w');
}
}
if (this.pauseButtonFull) {
- this.pauseButtonFull.innerHTML = Lang.Workspace.pause;
+ this.pauseButtonFull.textContent = Lang.Workspace.pause;
if (this.option !== 'minimize') {
this.pauseButtonFull.addClass('entryPauseButtonWorkspace_full');
this.pauseButtonFull.removeClass('entryRestartButtonWorkspace_full');
diff --git a/src/class/helper.js b/src/class/helper.js
index 71cf3aa22c..47ce947282 100644
--- a/src/class/helper.js
+++ b/src/class/helper.js
@@ -33,7 +33,7 @@ class EntryBlockHelper {
const commandTitle = Entry.createElement('div');
commandTitle.addClass('entryBlockHelperTitle textModeElem');
- commandTitle.innerHTML = 'Command';
+ commandTitle.textContent = 'Command';
blockHelperContent.appendChild(commandTitle);
blockHelperContent.addClass('entryBlockHelperIntro');
@@ -49,7 +49,7 @@ class EntryBlockHelper {
const descTitle = Entry.createElement('div');
descTitle.addClass('entryBlockHelperTitle textModeElem');
- descTitle.innerHTML = 'Explanation';
+ descTitle.textContent = 'Explanation';
blockHelperContent.appendChild(descTitle);
const blockHelperDescription = Entry.createElement(
@@ -58,12 +58,12 @@ class EntryBlockHelper {
);
blockHelperDescription.addClass('entryBlockHelperContent selectAble');
helper.blockHelperContent_.appendChild(blockHelperDescription);
- blockHelperDescription.innerHTML = Lang.Helper.Block_click_msg;
+ blockHelperDescription.textContent = Lang.Helper.Block_click_msg;
this.blockHelperDescription_ = blockHelperDescription;
const elementsTitle = Entry.createElement('div');
elementsTitle.addClass('entryBlockHelperTitle textModeElem');
- elementsTitle.innerHTML = 'Element';
+ elementsTitle.textContent = 'Element';
blockHelperContent.appendChild(elementsTitle);
this._elementsTitle = elementsTitle;
@@ -75,7 +75,7 @@ class EntryBlockHelper {
if (typeof CodeMirror !== 'undefined') {
const codeMirrorTitle = Entry.createElement('div');
codeMirrorTitle.addClass('entryBlockHelperTitle textModeElem');
- codeMirrorTitle.innerHTML = 'Example Code';
+ codeMirrorTitle.textContent = 'Example Code';
blockHelperContent.appendChild(codeMirrorTitle);
const codeMirrorView = Entry.createElement(
@@ -101,7 +101,7 @@ class EntryBlockHelper {
const codeMirrorDescTitle = Entry.createElement('div');
codeMirrorDescTitle.addClass('entryBlockHelperTitle textModeElem');
- codeMirrorDescTitle.innerHTML = 'Example Explanation';
+ codeMirrorDescTitle.textContent = 'Example Explanation';
blockHelperContent.appendChild(codeMirrorDescTitle);
this._codeMirrorDesc = Entry.createElement('div');
@@ -152,10 +152,10 @@ class EntryBlockHelper {
if (this.workspace.getMode() === Entry.Workspace.MODE_VIMBOARD) {
this._contentView.addClass('textMode');
- this.blockHelperDescription_.innerHTML = Lang.PythonHelper[`${type}_desc`];
+ this.blockHelperDescription_.textContent = Lang.PythonHelper[`${type}_desc`];
let elements = Lang.PythonHelper[`${type}_elements`];
- this._elementsContainer.innerHTML = '';
+ this._elementsContainer.textContent = '';
if (elements) {
this._elementsTitle.removeClass('entryRemove');
elements = elements.split('%next');
@@ -166,12 +166,12 @@ class EntryBlockHelper {
box.addClass('entryBlockHelperElementsContainer');
const left = Entry.createElement('div');
- left.innerHTML = contents[0];
+ left.textContent = contents[0];
left.addClass('elementLeft');
const right = Entry.createElement('div');
right.addClass('elementRight');
- right.innerHTML = contents[1];
+ right.textContent = contents[1];
box.appendChild(left);
box.appendChild(right);
this._elementsContainer.appendChild(box);
@@ -180,7 +180,7 @@ class EntryBlockHelper {
} else {
this._elementsTitle.addClass('entryRemove');
}
- this._codeMirrorDesc.innerHTML = Lang.PythonHelper[`${type}_exampleDesc`];
+ this._codeMirrorDesc.textContent = Lang.PythonHelper[`${type}_exampleDesc`];
const exampleCode = Lang.PythonHelper[`${type}_exampleCode`];
this._codeMirror.setValue(exampleCode);
@@ -188,7 +188,7 @@ class EntryBlockHelper {
def = Entry.block[type].pyHelpDef || def;
} else {
this._contentView.removeClass('textMode');
- this.blockHelperDescription_.innerHTML = description;
+ this.blockHelperDescription_.textContent = description;
}
code.createThread([def]);
diff --git a/src/class/object.js b/src/class/object.js
index b15be90f46..ef55e176e3 100644
--- a/src/class/object.js
+++ b/src/class/object.js
@@ -914,7 +914,7 @@ Entry.EntryObject = class {
'entryObjectRotateMethodLabelWorkspace'
);
rotationMethodWrapper.appendChild(rotateMethodLabelView);
- rotateMethodLabelView.innerHTML = `${Lang.Workspace.rotate_method}`;
+ rotateMethodLabelView.textContent = `${Lang.Workspace.rotate_method}`;
const rotateModeAView = Entry.createElement('span').addClass(
'entryObjectRotateModeWorkspace entryObjectRotateModeAWorkspace'
@@ -962,7 +962,7 @@ Entry.EntryObject = class {
'entryObjectRotateWorkspaceWrapper'
);
const rotateSpan = Entry.createElement('span').addClass('entryObjectRotateSpanWorkspace');
- rotateSpan.innerHTML = `${Lang.Workspace.rotation}`;
+ rotateSpan.textContent = `${Lang.Workspace.rotation}`;
const RotateDegCoordi = Entry.createElement('span').addClass(
'entryObjectCoordinateSpanWorkspace degree'
);
@@ -1001,7 +1001,7 @@ Entry.EntryObject = class {
const directionSpan = Entry.createElement('span').addClass(
'entryObjectDirectionSpanWorkspace'
);
- directionSpan.innerHTML = `${Lang.Workspace.direction}`;
+ directionSpan.textContent = `${Lang.Workspace.direction}`;
const DirectionDegCoordi = Entry.createElement('span').addClass(
'entryObjectCoordinateSpanWorkspace degree'
);
@@ -1054,7 +1054,7 @@ Entry.EntryObject = class {
'entryObjectCoordinateWorkspaceWrapper'
);
const xCoordi = Entry.createElement('span').addClass('entryObjectCoordinateSpanWorkspace');
- xCoordi.innerHTML = 'X';
+ xCoordi.textContent = 'X';
const xInput = Entry.createElement('input').addClass('entryObjectCoordinateInputWorkspace');
xInput.setAttribute('type', 'text');
xInput.onkeypress = this.editObjectValueWhenEnterPress;
@@ -1077,11 +1077,11 @@ Entry.EntryObject = class {
'entryObjectCoordinateWorkspaceWrapper'
);
const yCoordi = Entry.createElement('span').addClass('entryObjectCoordinateSpanWorkspace');
- yCoordi.innerHTML = 'Y';
+ yCoordi.textContent = 'Y';
const PerCoordi = Entry.createElement('span').addClass(
'entryObjectCoordinateSpanWorkspace'
);
- PerCoordi.innerHTML = '%';
+ PerCoordi.textContent = '%';
const yInput = Entry.createElement('input').addClass(
'entryObjectCoordinateInputWorkspace entryObjectCoordinateInputWorkspace_right'
);
@@ -1105,7 +1105,7 @@ Entry.EntryObject = class {
'entryObjectCoordinateSizeWrapper'
);
const sizeSpan = Entry.createElement('span').addClass('entryObjectCoordinateSizeWorkspace');
- sizeSpan.innerHTML = `${Lang.Workspace.Size}`;
+ sizeSpan.textContent = `${Lang.Workspace.Size}`;
const sizeInput = Entry.createElement('input').addClass(
'entryObjectCoordinateInputWorkspace',
'entryObjectCoordinateInputWorkspace_size'
diff --git a/src/class/playground.js b/src/class/playground.js
index b65ccfa355..08432d691c 100644
--- a/src/class/playground.js
+++ b/src/class/playground.js
@@ -72,7 +72,7 @@ Entry.Playground = class Playground {
const curtainView = Entry.createElement('div', 'entryCurtain')
.addClass('entryPlaygroundCurtainWorkspace entryRemove')
.appendTo(this.view_);
- curtainView.innerHTML = Lang.Workspace.cannot_edit_click_to_stop;
+ curtainView.textContent = Lang.Workspace.cannot_edit_click_to_stop;
curtainView.addEventListener('click', () => {
Entry.engine.toggleStop();
});
@@ -92,7 +92,7 @@ Entry.Playground = class Playground {
const pictureCurtainText = Entry.createElement('span', 'entryPictureCurtainText')
.addClass('entryPlaygroundPictureCurtainWorkspaceText')
.appendTo(pictureCurtainView);
- pictureCurtainText.innerHTML = Lang.Workspace.add_object_before_edit;
+ pictureCurtainText.textContent = Lang.Workspace.add_object_before_edit;
const textView = Entry.createElement('div', 'entryText')
.addClass('entryPlaygroundTextWorkspace entryRemove')
@@ -172,7 +172,7 @@ Entry.Playground = class Playground {
Entry.do('playgroundChangeViewMode', 'code', that.selectedViewMode);
})
.appendTo(tabList);
- codeTab.innerHTML = Lang.Workspace.tab_code;
+ codeTab.textContent = Lang.Workspace.tab_code;
this.tabViewElements.code = codeTab;
this._codeTab = codeTab;
@@ -182,7 +182,7 @@ Entry.Playground = class Playground {
Entry.do('playgroundChangeViewMode', 'picture', that.selectedViewMode);
})
.appendTo(tabList);
- pictureTab.innerHTML = Lang.Workspace.tab_picture;
+ pictureTab.textContent = Lang.Workspace.tab_picture;
this.tabViewElements.picture = pictureTab;
this.pictureTab = pictureTab;
@@ -192,7 +192,7 @@ Entry.Playground = class Playground {
.bindOnClick(() => {
Entry.do('playgroundChangeViewMode', 'text', that.selectedViewMode);
});
- textboxTab.innerHTML = Lang.Workspace.tab_text;
+ textboxTab.textContent = Lang.Workspace.tab_text;
this.tabViewElements.text = textboxTab;
this.textboxTab = textboxTab;
@@ -202,7 +202,7 @@ Entry.Playground = class Playground {
.bindOnClick(() => {
Entry.do('playgroundChangeViewMode', 'sound', that.selectedViewMode);
});
- soundTab.innerHTML = Lang.Workspace.tab_sound;
+ soundTab.textContent = Lang.Workspace.tab_sound;
this.tabViewElements.sound = soundTab;
this.soundTab = soundTab;
@@ -212,7 +212,7 @@ Entry.Playground = class Playground {
.bindOnClick(() => {
Entry.do('playgroundChangeViewMode', 'variable', that.selectedViewMode);
});
- variableTab.innerHTML = Lang.Workspace.tab_attribute;
+ variableTab.textContent = Lang.Workspace.tab_attribute;
this.tabViewElements.variable = variableTab;
this.variableTab = variableTab;
}
@@ -643,7 +643,7 @@ Entry.Playground = class Playground {
}
})
.appendTo(pictureAdd);
- innerPictureAdd.innerHTML = Lang.Workspace.picture_add;
+ innerPictureAdd.textContent = Lang.Workspace.picture_add;
this._pictureAddButton = innerPictureAdd;
const innerDrawNewPicture = Entry.createElement('div', 'entryNewPictureInner')
@@ -652,7 +652,7 @@ Entry.Playground = class Playground {
this.painter.newPicture();
})
.appendTo(pictureAdd);
- innerDrawNewPicture.innerHTML = Lang.Workspace.draw_new;
+ innerDrawNewPicture.textContent = Lang.Workspace.draw_new;
this._drawNewPictureButton = innerDrawNewPicture;
this.pictureListView_ = Entry.createElement('ul', 'entryPictureList')
@@ -903,7 +903,7 @@ Entry.Playground = class Playground {
this.fontSizeWrapper = fontSizeWrapper;
const fontSizeLabel = Entry.createElement('div').addClass('entryPlaygroundFontSizeLabel');
- fontSizeLabel.innerHTML = Lang.General.font_size;
+ fontSizeLabel.textContent = Lang.General.font_size;
fontSizeWrapper.appendChild(fontSizeLabel);
const fontSizeSlider = Entry.createElement('div').addClass('entryPlaygroundFontSizeSlider');
@@ -1039,7 +1039,7 @@ Entry.Playground = class Playground {
const tempNotification = Entry.createElement('span').addClass(
'entryPlaygroundSoundEditText'
);
- tempNotification.innerHTML = Lang.Menus.sound_edit_warn;
+ tempNotification.textContent = Lang.Menus.sound_edit_warn;
tempNotificationWrapper.appendChild(tempImage);
tempNotificationWrapper.appendChild(tempNotification);
@@ -1072,7 +1072,7 @@ Entry.Playground = class Playground {
);
}
});
- innerSoundAdd.innerHTML = Lang.Workspace.sound_add;
+ innerSoundAdd.textContent = Lang.Workspace.sound_add;
soundAdd.appendChild(innerSoundAdd);
soundView.appendChild(soundAdd);
const soundList = Entry.createElement('ul', 'entrySoundList').addClass(
@@ -1234,7 +1234,7 @@ Entry.Playground = class Playground {
(this.object.pictures || []).forEach((picture, i) => {
!picture.view && Entry.playground.generatePictureElement(picture);
const element = picture.view;
- element.orderHolder.innerHTML = i + 1;
+ element.orderHolder.textContent = i + 1;
});
isSelect && this.selectPicture(this.object.selectedPicture);
@@ -1292,7 +1292,7 @@ Entry.Playground = class Playground {
)}/thumb/${fileName}.png")`;
}
const sizeView = $element.find(`#s_${picture.id}`)[0];
- sizeView.innerHTML = `${picture.dimension.width} X ${picture.dimension.height}`;
+ sizeView.textContent = `${picture.dimension.width} X ${picture.dimension.height}`;
}
Entry.container.setPicture(picture);
@@ -1434,7 +1434,7 @@ Entry.Playground = class Playground {
(this.object.sounds || []).forEach((sound, i) => {
!sound.view && Entry.playground.generateSoundElement(sound);
const element = sound.view;
- element.orderHolder.innerHTML = i + 1;
+ element.orderHolder.textContent = i + 1;
});
}
@@ -1898,7 +1898,7 @@ Entry.Playground = class Playground {
.addClass('entryPlaygroundPictureSize')
.appendTo(
element
- ).innerHTML = `${picture.dimension.width} X ${picture.dimension.height}`;
+ ).textContent = `${picture.dimension.width} X ${picture.dimension.height}`;
const removeButton = Entry.createElement('div').addClass('entryPlayground_del');
const { Buttons = {} } = Lang || {};
@@ -2063,7 +2063,7 @@ Entry.Playground = class Playground {
nameView.onkeypress = Entry.Utils.blurWhenEnter;
Entry.createElement('div')
.addClass('entryPlaygroundSoundLength')
- .appendTo(element).innerHTML = `${sound.duration} ${Lang.General.second}`;
+ .appendTo(element).textContent = `${sound.duration} ${Lang.General.second}`;
const removeButton = Entry.createElement('div').addClass('entryPlayground_del');
const { Buttons = {} } = Lang || {};
const { delete: delText = '삭제' } = Buttons;
diff --git a/src/class/toast.js b/src/class/toast.js
index cdd84a60a4..d885626146 100644
--- a/src/class/toast.js
+++ b/src/class/toast.js
@@ -105,8 +105,8 @@ Entry.Toast = class Toast {
toastMessage.addClass('entryToastMessage');
if (Array.isArray(message)) {
- toastMessage.innerHTML = message.reduce(
- (total, current) => `${total}
${current}`,
+ toastMessage.textContent = message.reduce(
+ (total, current) => `${total}\n${current}`,
''
);
} else {
diff --git a/src/css/components/playground.less b/src/css/components/playground.less
index ac1a719e68..e5257fb9bb 100644
--- a/src/css/components/playground.less
+++ b/src/css/components/playground.less
@@ -202,15 +202,8 @@
z-index: 400;
background-color: rgba(248, 241, 204, 0.9);
border: 2px dashed #ffc800;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
justify-content: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
align-items: center;
- -webkit-box-orient: vertical;
- -webkit-box-direction: normal;
- -ms-flex-direction: column;
flex-direction: column;
.blockBackPackIcon {
@@ -415,6 +408,7 @@
opacity: 0.5;
z-index: 255;
cursor: pointer;
+ white-space: pre-line;
}
.entryPlaygroundCurtainPhone {
@@ -452,15 +446,10 @@
font-weight: bold;
line-height: 1.33;
letter-spacing: -0.6px;
- display: -webkit-box;
- display: -ms-flexbox;
display: flex;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
justify-content: center; /* align horizontal */
- -webkit-box-align: center;
- -ms-flex-align: center;
align-items: center; /* align vertical */
+ white-space: pre-line;
}
.entryPlaygroundTableCurtainWorkspace {
@@ -484,14 +473,8 @@
font-weight: bold;
line-height: 1.33;
letter-spacing: -0.6px;
- display: -webkit-box;
- display: -ms-flexbox;
display: flex;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
justify-content: center; /* align horizontal */
- -webkit-box-align: center;
- -ms-flex-align: center;
align-items: center; /* align vertical */
}
@@ -638,6 +621,11 @@
cursor: pointer;
}
+.entryPlaygroundPictureElement::-moz-selection {
+ cursor: move;
+ background-color: #fff;
+}
+
.entryPlaygroundPictureElement::selection {
cursor: move;
background-color: #fff;
@@ -692,7 +680,6 @@
cursor: text;
border: 1px solid #e2e2e2;
border-radius: 4px;
- -webkit-box-sizing: border-box;
box-sizing: border-box;
}
.entryPlaygroundPictureName:focus,
@@ -764,7 +751,6 @@
}
}
.pop_selectbox * {
- -webkit-box-sizing: content-box;
box-sizing: content-box;
}
.pop_selectbox .tooltip_box {
@@ -1103,14 +1089,8 @@
overflow: hidden;
border-left: 1px solid #e2e2e2;
background-color: #f2f2f2;
- display: -webkit-box;
- display: -ms-flexbox;
display: flex;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
justify-content: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
align-items: center;
.entryPlaygroundSoundEditWrapper {
@@ -1141,6 +1121,7 @@
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
+ white-space: pre-line;
}
}
@@ -1255,7 +1236,6 @@
.entryPlaygroundSoundName {
width: 100%;
height: 24px;
- -webkit-box-sizing: border-box;
box-sizing: border-box;
margin-top: 10px;
padding: 0 4px;
@@ -1332,7 +1312,6 @@
width: 136px;
height: 8px;
border-radius: 3px;
- -webkit-box-shadow: inset 1px 1px 1px 0 rgba(0, 0, 0, 0.03);
box-shadow: inset 1px 1px 1px 0 rgba(0, 0, 0, 0.03);
background-color: #d8d8d8;
}
@@ -1479,14 +1458,8 @@
overflow: hidden;
border-left: 1px solid #e2e2e2;
background-color: #f2f2f2;
- display: -webkit-box;
- display: -ms-flexbox;
display: flex;
- -webkit-box-pack: center;
- -ms-flex-pack: center;
justify-content: center;
- -webkit-box-align: center;
- -ms-flex-align: center;
align-items: center;
.entryPlaygroundTableEditWrapper {
@@ -1633,7 +1606,6 @@
.entryPlaygroundTableName {
width: 100%;
height: 24px;
- -webkit-box-sizing: border-box;
box-sizing: border-box;
margin-top: 12px;
padding: 0 4px;
diff --git a/src/css/components/toast.less b/src/css/components/toast.less
index 6e46ae5527..3ca2e308ae 100644
--- a/src/css/components/toast.less
+++ b/src/css/components/toast.less
@@ -51,6 +51,7 @@
font-size: 9pt;
margin-top: 4px;
margin-bottom: 2px;
+ white-space: pre-line;
}
.entryMobileToastWrapper {
diff --git a/src/playground/block_menu.ts b/src/playground/block_menu.ts
index 15e5f920da..a9b7a3bd32 100644
--- a/src/playground/block_menu.ts
+++ b/src/playground/block_menu.ts
@@ -1361,7 +1361,7 @@ class BlockMenu extends ModelClass {
class: 'entryCategoryListWorkspace',
});
} else {
- this.categoryWrapper.innerHTML = '';
+ this.categoryWrapper.textContent = '';
}
this._categoryCol = Entry.Dom('ul', {
diff --git a/src/playground/blocks/block_expansion_festival.js b/src/playground/blocks/block_expansion_festival.js
index 9da0b0d899..34e4b4fc69 100644
--- a/src/playground/blocks/block_expansion_festival.js
+++ b/src/playground/blocks/block_expansion_festival.js
@@ -326,9 +326,7 @@ Entry.EXPANSION_BLOCK.festival = {
overview: 'overview',
},
strip(html) {
- const tmp = document.createElement('DIV');
- tmp.innerHTML = html;
- return tmp.textContent || tmp.innerText || '';
+ return Entry.Utils.extractTextFromHTML(html);
},
monthMap: {
January: 1,
@@ -437,7 +435,10 @@ Entry.EXPANSION_BLOCK.festival.getBlocks = function() {
return new PromiseManager().Promise((resolve) => {
callApi(key, { url: `${Entry.EXPANSION_BLOCK.festival.api}/${contentid}` })
.then((response) => {
- const item = response.data.response.body.items.item;
+ let item = response.data.response.body.items.item;
+ if (Array.isArray(item)) {
+ item = item[0];
+ }
if (item && item[infoType]) {
return resolve(Entry.EXPANSION_BLOCK.festival.strip(item[infoType]));
}
diff --git a/src/util/htmlElementPatcher.js b/src/util/htmlElementPatcher.js
index 45cd7cea14..636630f6fb 100644
--- a/src/util/htmlElementPatcher.js
+++ b/src/util/htmlElementPatcher.js
@@ -14,7 +14,7 @@
p.text = function(str) {
if (str) {
- this.innerHTML = str;
+ this.textContent = str;
}
return this;
};
diff --git a/src/util/utils.js b/src/util/utils.js
index d4c366dc3a..3a802dfdbb 100644
--- a/src/util/utils.js
+++ b/src/util/utils.js
@@ -1381,7 +1381,7 @@ Entry.computeInputWidth = (function() {
document.body.appendChild(elem);
}
- elem.innerHTML = value;
+ elem.textContent = value;
const ret = `${Number(elem.offsetWidth + 10)}px`;
if (window.fontLoaded) {
@@ -3051,3 +3051,9 @@ Entry.Utils.doCodeChange = () => {
Entry.codeChangedEvent.notify();
}
};
+
+Entry.Utils.extractTextFromHTML = (htmlString) => {
+ const parser = new DOMParser();
+ const dom = parser.parseFromString(htmlString, 'text/html');
+ return dom.body.textContent || '';
+};
diff --git a/types/index.d.ts b/types/index.d.ts
index 3d08339688..1bd4ffff12 100644
--- a/types/index.d.ts
+++ b/types/index.d.ts
@@ -64,6 +64,7 @@ declare interface EntryDomOptions {
declare interface EntryDom extends JQuery {
innerHTML?: string;
+ textContent?: string;
bindOnClick?: (e: any) => this;
}