Skip to content

Commit

Permalink
Fixed range selection and added emoji.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsharman committed Mar 20, 2024
1 parent c24b278 commit 5e6bb24
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 31 deletions.
54 changes: 27 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@caspingus/lt",
"version": "2.8.0",
"version": "2.8.1",
"description": "A utility library of helpers and tools for working with Learnosity APIs.",
"main": "src/index.js",
"author": "michael@learnosity.com",
Expand Down
10 changes: 7 additions & 3 deletions src/authoring/extensions/ui/ssmlEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ export function run() {
* @since 2.8.0
*/
export function launchSsmlEditor(attribute, callback) {
const currentSelectedText = getSelection().toString();
const currentSelectedText = window.getSelection().toString();
const rangeSelectedHTML = window.getSelection().getRangeAt(0);
const container = document.createElement('div');
container.appendChild(rangeSelectedHTML.cloneContents());
const currentSelectedHTML = container.innerHTML;
const templateSsmlEditor = `
<div class="lrn-qe lrn-qe-modal" style="display: block;" id="lt__ssmlModalWrapper">
<div class="lrn-qe-ui">
Expand Down Expand Up @@ -150,7 +154,7 @@ export function launchSsmlEditor(attribute, callback) {
<button type="button" class="lrn-qe-btn lrn-qe-btn-primary lt__ssml-add" data-lrn-qe-modal-action="confirm"><span>Add SSML</span></button>
</li>&nbsp;
<li class="lrn-qe-li lrn-qe-modal-footer-item">
<button type="button" class="lrn-qe-btn lrn-qe-btn-primary lt__ssml-generate-audio"><span>Generate audio</span></button>
<button type="button" class="lrn-qe-btn lrn-qe-btn-primary lt__ssml-generate-audio"><span>Generate audio</span></button>
</li>
</ul>
</div>
Expand All @@ -170,7 +174,7 @@ export function launchSsmlEditor(attribute, callback) {
elClose[i].addEventListener('click', () => {
removeElement('lt__ssmlModalWrapper');
delete window.quill;
return callback(currentSelectedText);
return callback(currentSelectedHTML);
});
}

Expand Down

0 comments on commit 5e6bb24

Please sign in to comment.