Skip to content

Commit 7554d75

Browse files
authored
2.46.0
2 parents 9799bc7 + d9797fc commit 7554d75

File tree

25 files changed

+1459
-529
lines changed

25 files changed

+1459
-529
lines changed

.github/scripts/manage-deploy.js

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
require("dotenv").config();
2+
const { Octokit } = require("@octokit/rest");
3+
4+
const octokit = new Octokit({
5+
auth: process.env.GITHUB_TOKEN,
6+
});
7+
8+
async function closeIssuesForMilestone() {
9+
const owner = "jihong88";
10+
const repo = "suneditor";
11+
const versionName = process.env.VERSION_NAME;
12+
13+
if (!versionName) {
14+
console.log("No version name provided");
15+
return;
16+
}
17+
18+
try {
19+
const milestones = await octokit.rest.issues.listMilestones({
20+
owner,
21+
repo,
22+
state: "open",
23+
});
24+
25+
const milestone = milestones.data.find((m) => m.title === versionName);
26+
if (!milestone) {
27+
console.log("No matching milestone found");
28+
return;
29+
}
30+
31+
const issues = await octokit.issues.listForRepo({
32+
owner,
33+
repo,
34+
state: "open",
35+
milestone: milestone.number,
36+
});
37+
38+
issues.data.forEach(async (issue) => {
39+
const comment = {
40+
owner,
41+
repo,
42+
issue_number: issue.number,
43+
body:
44+
"Thank you for your engagement with the project.\n" +
45+
"This issue has been resolved for version " +
46+
versionName +
47+
".\n" +
48+
"If the problem persists or if you believe this issue is still relevant,\n" +
49+
"please reopen it with additional comments.",
50+
};
51+
await octokit.issues.createComment(comment);
52+
53+
await octokit.issues.update({
54+
owner,
55+
repo,
56+
issue_number: issue.number,
57+
state: "closed",
58+
});
59+
});
60+
} catch (error) {
61+
console.error(`Error while processing issues for milestone: ${error}`);
62+
}
63+
}
64+
65+
closeIssuesForMilestone();

.github/scripts/manage-issues.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
require("dotenv").config();
2+
const { Octokit } = require("@octokit/rest");
3+
4+
const octokit = new Octokit({
5+
auth: process.env.GITHUB_TOKEN,
6+
});
7+
8+
async function closeOldIssues() {
9+
try {
10+
const owner = "jihong88";
11+
const repo = "suneditor";
12+
const issues = await octokit.issues.listForRepo({
13+
owner,
14+
repo,
15+
state: "open",
16+
});
17+
18+
const sixWeeksAgo = new Date();
19+
sixWeeksAgo.setDate(sixWeeksAgo.getDate() - 42); // 6 weeks
20+
21+
for (const issue of issues.data) {
22+
const lastUpdated = new Date(issue.updated_at);
23+
if (lastUpdated < sixWeeksAgo) {
24+
const comment = {
25+
owner,
26+
repo,
27+
issue_number: issue.number,
28+
body:
29+
"Thank you for your engagement with the project.\n" +
30+
"Due to a lack of activity for over 6 weeks, this issue has been automatically closed." +
31+
"\nThis is part of the process to keep the project up-to-date.\n\n" +
32+
"If a new version has been released recently, please test your scenario with that version to see if the issue persists.\n" +
33+
"If the problem still exists or if you believe this issue is still relevant, \n" +
34+
"feel free to reopen it and provide additional comments.\n\n" +
35+
"I truly appreciate your continuous interest and support for the project. Your feedback is crucial in improving its quality.",
36+
};
37+
await octokit.issues.createComment(comment);
38+
39+
await octokit.issues.update({
40+
owner,
41+
repo,
42+
issue_number: issue.number,
43+
state: "closed",
44+
});
45+
}
46+
}
47+
} catch (error) {
48+
console.error(`Error while closing issues: ${error}`);
49+
}
50+
}
51+
52+
closeOldIssues();
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Deploy Management Action
2+
3+
on:
4+
push:
5+
branches:
6+
- release
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v2
17+
with:
18+
node-version: "12"
19+
registry-url: "https://registry.npmjs.org/"
20+
21+
- name: Check if version has been updated
22+
id: check-version
23+
run: |
24+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
25+
LAST_GIT_TAG=$(git describe --tags --abbrev=0)
26+
if [ "v$PACKAGE_VERSION" == "$LAST_GIT_TAG" ]; then
27+
echo "Package version ($PACKAGE_VERSION) has not been updated since the last tag ($LAST_GIT_TAG)."
28+
exit 1
29+
else
30+
echo "Package version has been updated to $PACKAGE_VERSION."
31+
fi
32+
33+
- name: Install dependencies
34+
run: npm install && npm audit fix
35+
36+
- name: Build
37+
run: npm run build
38+
39+
- name: Deploy
40+
run: npm publish
41+
env:
42+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
43+
44+
- name: Execute script for milestone
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
VERSION_NAME: ${{ steps.check-version.outputs.package_version }}
48+
run: node .github/scripts/manage-deploy.js $VERSION_NAME
49+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Issue Management Action
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
7+
jobs:
8+
manage-issues:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Run script to manage issues
12+
run: node .github/scripts/manage-issues.js
13+
env:
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ bower_components/**
1414

1515
#dev
1616
.git/**
17-
package-lock.json
17+
package-lock.json
18+
/.vs

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# SunEditor
22
Vanilla javascript based WYSIWYG web editor, with no dependencies.
33
SunEditor supports IE11 and all modern browsers with no dependencies and polyfill.
4+
Coded based on ES5 in supported by IE11.
45

56
#### Demo : <a href="http://suneditor.com" target="_blank">suneditor.com</a>
67

@@ -390,6 +391,7 @@ plugins: [
390391
// * {custom_plugin, ...plugins}
391392

392393
// Values
394+
strictMode : Option to disable clean mode, which checks the styles, classes, etc. of the editor content. default : false {Boolean}
393395
lang : language object. default : en {Object}
394396
defaultTag : Specifies default tag name of the editor. default: 'p' {String}
395397
textTags : You can change the tag of the default text button. default: { bold: 'STRONG', underline: 'U', italic: 'EM', strike: 'DEL' }

dist/suneditor.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "suneditor",
3-
"version": "2.45.1",
3+
"version": "2.46.0",
44
"description": "Vanilla javascript based WYSIWYG web editor, with no dependencies",
55
"author": "JiHong.Lee",
66
"license": "MIT",
@@ -30,12 +30,14 @@
3030
],
3131
"devDependencies": {
3232
"@babel/core": "^7.21.3",
33+
"@octokit/rest": "^20.1.0",
3334
"@webpack-cli/init": "^0.2.2",
3435
"babel-loader": "^8.1.0",
3536
"clean-webpack-plugin": "^0.1.19",
3637
"codemirror": "^5.61.0",
3738
"css-loader": "^1.0.1",
3839
"csstype": "^2.6.13",
40+
"dotenv": "^16.4.5",
3941
"file-loader": "^2.0.0",
4042
"html-webpack-plugin": "^3.2.0",
4143
"jasmine": "^2.99.0",
@@ -53,7 +55,6 @@
5355
"webpack-dev-server": "^3.11.0",
5456
"webpack-merge": "^4.2.2"
5557
},
56-
"dependencies": {},
5758
"keywords": [
5859
"wysiwyg",
5960
"wysiwyg editor",

sample/html/options.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
<article class="markdown-body entry-content">
6969
<div style="background-color: #f3f3f3; padding: 4px 20px 20px 20px;">
7070
<h4 style="color: #b94a48;">--Value</h4>
71+
<label><input type="checkbox" id="strictMode">&nbsp;&nbsp;strictMode&nbsp;&nbsp;&nbsp;</label><br><br>
7172
<label><input type="checkbox" id="defaultTag">&nbsp;&nbsp;defaultTag&nbsp;&nbsp;&nbsp;</label>
7273
<input type="text" id="defaultTag_value" placeholder="String ('p', 'div'..)"></input>
7374
<br><br>
@@ -601,6 +602,7 @@ <h2 class="sub-title">Applied options</h2>
601602
imageTable.innerHTML = '';
602603

603604
var options = {
605+
strictMode: document.getElementById('strictMode').checked ? true : undefined,
604606
defaultTag: document.getElementById('defaultTag').checked ? document.getElementById('defaultTag_value').value : undefined,
605607
textTags: document.getElementById('textTags').checked ? {
606608
bold: 'b',

src/lang/fa.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { Lang } from './Lang';
2+
3+
declare const fa: Lang;
4+
5+
export default fa;

0 commit comments

Comments
 (0)