mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-09-24 16:40:55 -06:00
Merge branch 'Ionaru:master' into dev-headlines
This commit is contained in:
commit
1532b5b074
20
.github/workflows/cd.yaml
vendored
20
.github/workflows/cd.yaml
vendored
@ -18,11 +18,11 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: current
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- run: npm audit --omit=dev
|
||||
|
||||
@ -36,28 +36,28 @@ jobs:
|
||||
node-version: [ '14', '16', '18' ]
|
||||
|
||||
steps:
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- run: npm ci
|
||||
|
||||
- name: Test
|
||||
run: npm test
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: failure()
|
||||
with:
|
||||
name: cypress-screenshots
|
||||
name: cypress-screenshots-nodejs-${{ matrix.node-version }}
|
||||
path: cypress/screenshots
|
||||
retention-days: 7
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: cypress-videos
|
||||
name: cypress-videos-nodejs-${{ matrix.node-version }}
|
||||
path: cypress/videos
|
||||
retention-days: 7
|
||||
|
||||
@ -68,11 +68,11 @@ jobs:
|
||||
if: github.event_name == 'push'
|
||||
|
||||
steps:
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: current
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- run: npm ci
|
||||
|
||||
|
32
CHANGELOG.md
32
CHANGELOG.md
@ -5,6 +5,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
<!-- ## [Unreleased] -->
|
||||
## [2.20.0] - 2025-03-04
|
||||
### Added
|
||||
- Support for `marked` extensions (Thanks to [@codingjoe], [#611], [#514]).
|
||||
|
||||
## [2.19.0] - 2025-02-18
|
||||
### Added
|
||||
- `updateStatusBar` type to typescript definitions (Thanks to [@borodean], [#519]).
|
||||
- `"upload-image"` option to the `ToolbarButton` typescript definitions (Thanks to [@borodean], [#520]).
|
||||
- `imageInputName` option to set a custom "name" attribute for the image input (Thanks to [@robinvandernoord], [#573]).
|
||||
|
||||
### Fixed
|
||||
- Relative image paths using the stylesheet as the source instead of the document (Thanks to [@p1gp1g], [#591]).
|
||||
- Excessive memory usage with the `previewImagesInEditor` option (Thanks to [@p1gp1g], [#592]).
|
||||
- Parentheses in the alt text of images causing the image not to load then using `previewImagesInEditor` (Thanks to [@mayraamaral], [#608]).
|
||||
|
||||
## [2.18.0] - 2022-09-20
|
||||
### Added
|
||||
- `toolbarButtonClassPrefix` option to resolve conflicts with Bootstrap classes ([#493]).
|
||||
@ -257,6 +272,8 @@ Project forked from [SimpleMDE](https://github.com/sparksuite/simplemde-markdown
|
||||
- Cursor not always showing in "text" mode over the edit field
|
||||
|
||||
<!-- Linked issues -->
|
||||
[#611]: https://github.com/Ionaru/easy-markdown-editor/issues/611
|
||||
[#514]: https://github.com/Ionaru/easy-markdown-editor/issues/514
|
||||
[#493]: https://github.com/Ionaru/easy-markdown-editor/issues/493
|
||||
[#478]: https://github.com/Ionaru/easy-markdown-editor/issues/478
|
||||
[#399]: https://github.com/Ionaru/easy-markdown-editor/issues/399
|
||||
@ -278,6 +295,12 @@ Project forked from [SimpleMDE](https://github.com/sparksuite/simplemde-markdown
|
||||
[#9]: https://github.com/Ionaru/easy-markdown-editor/issues/9
|
||||
|
||||
<!-- Linked PRs -->
|
||||
[#608]: https://github.com/Ionaru/easy-markdown-editor/pull/608
|
||||
[#592]: https://github.com/Ionaru/easy-markdown-editor/pull/592
|
||||
[#591]: https://github.com/Ionaru/easy-markdown-editor/pull/591
|
||||
[#573]: https://github.com/Ionaru/easy-markdown-editor/pull/573
|
||||
[#520]: https://github.com/Ionaru/easy-markdown-editor/pull/520
|
||||
[#519]: https://github.com/Ionaru/easy-markdown-editor/pull/519
|
||||
[#492]: https://github.com/Ionaru/easy-markdown-editor/pull/492
|
||||
[#488]: https://github.com/Ionaru/easy-markdown-editor/pull/488
|
||||
[#486]: https://github.com/Ionaru/easy-markdown-editor/pull/486
|
||||
@ -417,9 +440,16 @@ Project forked from [SimpleMDE](https://github.com/sparksuite/simplemde-markdown
|
||||
[@hlf20010508]: https://github.com/hlf20010508
|
||||
[@ZsgsDesign]: https://github.com/ZsgsDesign
|
||||
[@sghoweri]: https://github.com/sghoweri
|
||||
[@borodean]: https://github.com/borodean
|
||||
[@robinvandernoord]: https://github.com/robinvandernoord
|
||||
[@p1gp1g]: https://github.com/p1gp1g
|
||||
[@mayraamaral]: https://github.com/mayraamaral
|
||||
[@codingjoe]: https://github.com/codingjoe
|
||||
|
||||
<!-- Linked versions -->
|
||||
[Unreleased]: https://github.com/Ionaru/easy-markdown-editor/compare/2.18.0...HEAD
|
||||
[Unreleased]: https://github.com/Ionaru/easy-markdown-editor/compare/2.20.0...HEAD
|
||||
[2.20.0]: https://github.com/Ionaru/easy-markdown-editor/compare/2.19.0...2.20.0
|
||||
[2.19.0]: https://github.com/Ionaru/easy-markdown-editor/compare/2.18.0...2.19.0
|
||||
[2.18.0]: https://github.com/Ionaru/easy-markdown-editor/compare/2.17.0...2.18.0
|
||||
[2.17.0]: https://github.com/Ionaru/easy-markdown-editor/compare/2.16.1...2.17.0
|
||||
[2.16.1]: https://github.com/Ionaru/easy-markdown-editor/compare/2.16.0...2.16.1
|
||||
|
@ -1,7 +1,8 @@
|
||||
# EasyMDE - Markdown Editor
|
||||
|
||||
[](https://www.npmjs.com/package/easymde)
|
||||
[](https://www.npmjs.com/package/easymde/v/next)
|
||||
[](https://www.npmjs.com/package/easymde/v/next)
|
||||
[](https://www.npmjs.com/package/easymde/v/v3-alpha)
|
||||
[](https://github.com/Ionaru/easy-markdown-editor/actions?query=branch%3Amaster)
|
||||
|
||||
> This repository is a fork of
|
||||
|
43
cypress/e2e/4.image-rendering/image-rendering.cy.js
Normal file
43
cypress/e2e/4.image-rendering/image-rendering.cy.js
Normal file
@ -0,0 +1,43 @@
|
||||
/// <reference types="cypress" />
|
||||
|
||||
describe('Image rendering', () => {
|
||||
|
||||
const imageUrl = 'https://picsum.photos/id/237/150';
|
||||
|
||||
beforeEach(() => {
|
||||
cy.visit(__dirname + '/index.html');
|
||||
cy.intercept('GET', imageUrl).as('image');
|
||||
});
|
||||
|
||||
it('must render an image inside the editor', () => {
|
||||
cy.get('.EasyMDEContainer').should('be.visible');
|
||||
cy.get('#textarea').should('not.be.visible');
|
||||
|
||||
cy.get('.EasyMDEContainer .CodeMirror').type(imageUrl);
|
||||
cy.get('.EasyMDEContainer .CodeMirror').type('{home}');
|
||||
|
||||
cy.wait('@image');
|
||||
|
||||
cy.get(`.EasyMDEContainer [data-img-src="${imageUrl}"]`).should('be.visible');
|
||||
|
||||
cy.previewOn();
|
||||
|
||||
cy.get('.EasyMDEContainer .editor-preview').should('contain.html', `<p><img src="${imageUrl}" alt="Dog!"></p>`);
|
||||
});
|
||||
|
||||
it('must be able to handle parentheses inside image alt text', () => {
|
||||
cy.get('.EasyMDEContainer').should('be.visible');
|
||||
cy.get('#textarea').should('not.be.visible');
|
||||
|
||||
cy.get('.EasyMDEContainer .CodeMirror').type(imageUrl);
|
||||
cy.get('.EasyMDEContainer .CodeMirror').type('{home}');
|
||||
|
||||
cy.wait('@image');
|
||||
|
||||
cy.get(`.EasyMDEContainer [data-img-src="${imageUrl}"]`).should('be.visible');
|
||||
|
||||
cy.previewOn();
|
||||
|
||||
cy.get('.EasyMDEContainer .editor-preview').should('contain.html', `<p><img src="${imageUrl}" alt="Dog! (He's a good boy!)"></p>`);
|
||||
});
|
||||
});
|
20
cypress/e2e/4.image-rendering/index.html
Normal file
20
cypress/e2e/4.image-rendering/index.html
Normal file
@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Default</title>
|
||||
<link rel="stylesheet" href="../../../dist/easymde.min.css">
|
||||
<script src="../../../dist/easymde.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<textarea id="textarea"></textarea>
|
||||
<script>
|
||||
const easyMDE = new EasyMDE({
|
||||
previewImagesInEditor: true,
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
24
cypress/e2e/5-marked-options/index.html
Normal file
24
cypress/e2e/5-marked-options/index.html
Normal file
@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Default</title>
|
||||
<link rel="stylesheet" href="../../../dist/easymde.min.css">
|
||||
<script src="../../../dist/easymde.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<textarea id="textarea"></textarea>
|
||||
<script>
|
||||
const easyMDE = new EasyMDE({
|
||||
renderingConfig: {
|
||||
markedOptions: {
|
||||
headerPrefix: 'header-prefix-',
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
18
cypress/e2e/5-marked-options/marked-options.cy.js
Normal file
18
cypress/e2e/5-marked-options/marked-options.cy.js
Normal file
@ -0,0 +1,18 @@
|
||||
/// <reference types="cypress" />
|
||||
|
||||
describe('Marked options', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit(__dirname + '/index.html');
|
||||
});
|
||||
|
||||
it('must apply the markedOptions to the markdown parser', () => {
|
||||
cy.get('.EasyMDEContainer').should('be.visible');
|
||||
cy.get('#textarea').should('not.be.visible');
|
||||
|
||||
cy.get('.EasyMDEContainer .CodeMirror').type('# Title{enter}');
|
||||
|
||||
cy.previewOn();
|
||||
|
||||
cy.get('.EasyMDEContainer .editor-preview').should('contain.html', '<h1 id="header-prefix-title">Title</h1>');
|
||||
});
|
||||
});
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "easymde",
|
||||
"version": "2.18.0",
|
||||
"version": "2.20.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "easymde",
|
||||
"version": "2.18.0",
|
||||
"version": "2.20.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/codemirror": "^5.60.10",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "easymde",
|
||||
"version": "2.18.0",
|
||||
"version": "2.20.0",
|
||||
"description": "A simple, beautiful, and embeddable JavaScript Markdown editor that easy to use. Features include autosaving and spell checking.",
|
||||
"files": [
|
||||
"dist/**/*",
|
||||
|
@ -2071,7 +2071,7 @@ EasyMDE.prototype.markdown = function (text) {
|
||||
}
|
||||
|
||||
// Set options
|
||||
marked.setOptions(markedOptions);
|
||||
marked.use(markedOptions);
|
||||
|
||||
// Convert the markdown to HTML
|
||||
var htmlText = marked.parse(text);
|
||||
@ -2681,7 +2681,7 @@ EasyMDE.prototype.render = function (el) {
|
||||
return;
|
||||
}
|
||||
if (!parentEl.hasAttribute('data-img-src')) {
|
||||
var srcAttr = parentEl.innerText.match('\\((.*)\\)'); // might require better parsing according to markdown spec
|
||||
var srcAttr = parentEl.innerText.match(/!\[.*?\]\((.*?)\)/); // might require better parsing according to markdown spec
|
||||
if (!window.EMDEimagesCache) {
|
||||
window.EMDEimagesCache = {};
|
||||
}
|
||||
|
2
types/easymde.d.ts
vendored
2
types/easymde.d.ts
vendored
@ -101,7 +101,7 @@ declare namespace EasyMDE {
|
||||
interface RenderingOptions {
|
||||
codeSyntaxHighlighting?: boolean;
|
||||
hljs?: any;
|
||||
markedOptions?: marked.MarkedOptions;
|
||||
markedOptions?: marked.MarkedExtension;
|
||||
sanitizerFunction?: (html: string) => string;
|
||||
singleLineBreaks?: boolean;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user