mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-07-14 22:40:33 +03:00
Migrate notifications
to new API
This commit is contained in:
parent
c9c9f1ab4b
commit
e7c14be227
@ -8,18 +8,14 @@
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
|
||||
*/
|
||||
let NotificationElement;
|
||||
const createDOMPurify = require('dompurify');
|
||||
const fs = require('fs-plus');
|
||||
const path = require('path');
|
||||
const marked = require('marked');
|
||||
const {shell} = require('electron');
|
||||
|
||||
const NotificationIssue = require('./notification-issue');
|
||||
const TemplateHelper = require('./template-helper');
|
||||
const UserUtilities = require('./user-utilities');
|
||||
|
||||
let DOMPurify = null;
|
||||
|
||||
const NotificationTemplate = `\
|
||||
<div class="content">
|
||||
<div class="message item"></div>
|
||||
@ -110,12 +106,7 @@ module.exports =
|
||||
|
||||
const notificationContainer = this.element.querySelector('.message');
|
||||
|
||||
if (DOMPurify === null) {
|
||||
DOMPurify = createDOMPurify();
|
||||
}
|
||||
notificationContainer.innerHTML = DOMPurify.sanitize(
|
||||
marked.parse(this.model.getMessage())
|
||||
);
|
||||
notificationContainer.innerHTML = atom.ui.markdown.render(this.model.getMessage());
|
||||
|
||||
if (detail = this.model.getDetail()) {
|
||||
let stack;
|
||||
@ -137,7 +128,7 @@ module.exports =
|
||||
metaContainer = this.element.querySelector('.meta');
|
||||
metaContainer.appendChild(TemplateHelper.render(this.metaTemplate));
|
||||
const description = this.element.querySelector('.description');
|
||||
description.innerHTML = marked.parse(metaContent);
|
||||
description.innerHTML = atom.ui.markdown.render(metaContent);
|
||||
}
|
||||
|
||||
if (options.buttons && (options.buttons.length > 0)) {
|
||||
|
@ -9,9 +9,7 @@
|
||||
"atom": ">0.50.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"dompurify": "3.0.3",
|
||||
"fs-plus": "^3.0.0",
|
||||
"marked": "5.0.3",
|
||||
"moment": "^2.19.3",
|
||||
"semver": "^7.0.0",
|
||||
"stacktrace-parser": "^0.1.3",
|
||||
|
36
spec/ui-spec.js
Normal file
36
spec/ui-spec.js
Normal file
@ -0,0 +1,36 @@
|
||||
const UI = require("../src/ui.js");
|
||||
|
||||
describe("Just testing for now", async () => {
|
||||
console.log("here0");
|
||||
const content =
|
||||
`
|
||||
# Hello World
|
||||
|
||||
My friends
|
||||
|
||||
\`\`\`javascript
|
||||
const hello = "world";
|
||||
\`\`\`
|
||||
|
||||
`;
|
||||
|
||||
console.log("here4");
|
||||
try {
|
||||
const html = UI.markdown.renderMarkdown(content);
|
||||
console.log("here3");
|
||||
console.log(html);
|
||||
|
||||
const htmlDom = UI.markdown.convertToDOM(html);
|
||||
|
||||
console.log("here1");
|
||||
await UI.markdown.applySyntaxHighlighting(htmlDom);
|
||||
console.log("here2");
|
||||
|
||||
console.log(htmlDom.innerHTML);
|
||||
|
||||
} catch(er) {
|
||||
console.log("we errored");
|
||||
console.error(er);
|
||||
}
|
||||
|
||||
});
|
Loading…
Reference in New Issue
Block a user