-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat (RichEditor) make setup function * feat (RichEditor) apply 'embed-responsive' class to <iframe />; container * feat (About) add 'frameborder' to whilelist of iframe
- Loading branch information
1 parent
d6157db
commit f12c7e3
Showing
5 changed files
with
83 additions
and
31 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
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,34 @@ | ||
// @flow strict | ||
|
||
function addResponsive(el: HTMLElement): void { | ||
// $FlowIgnore | ||
const parent = el.parentNode.parentNode; | ||
// $FlowIgnore | ||
parent.classList.add('embed-responsive'); | ||
} | ||
|
||
// $FlowIgnore | ||
const setup = editor => { | ||
// set the editor font size | ||
editor.on('init', () => { | ||
/* eslint-disable no-param-reassign */ | ||
editor.getBody().style.fontSize = '16px'; | ||
}); | ||
// listen for toolbar buttons | ||
editor.on('ExecCommand', e => { | ||
// 'command' name of the toolbar clicked. | ||
const { command } = e; | ||
if (command === 'mceInsertContent') { | ||
// get editor's iframe area | ||
const iframeContainer = e.target.contentAreaContainer.firstChild; | ||
// access elements of an <iframe> | ||
const container = iframeContainer.contentWindow.document.body; | ||
// get all iframes that are current in the editor's content | ||
const iframes = container.querySelectorAll('iframe'); | ||
// apply each iframe's parent the responsive class | ||
iframes.forEach(addResponsive); | ||
} | ||
}); | ||
}; | ||
|
||
export default setup; |
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
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
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 |
---|---|---|
|
@@ -50,6 +50,8 @@ | |
} | ||
|
||
.description { | ||
// taken from Bootstrap | ||
|
||
a { | ||
font-size: 16px; | ||
color: $color_blue; | ||
|