Skip to content

Commit

Permalink
build(core): prettier format
Browse files Browse the repository at this point in the history
  • Loading branch information
pubuzhixing8 committed Mar 17, 2023
1 parent b72e692 commit 68c234e
Show file tree
Hide file tree
Showing 129 changed files with 7,216 additions and 7,490 deletions.
28 changes: 14 additions & 14 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"$schema": "https://unpkg.com/@changesets/config@1.5.0/schema.json",
"changelog": [
"@changesets/changelog-github",
{
"repo": "worktile/slate-angular"
}
],
"commit": false,
"linked": [],
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}
"$schema": "https://unpkg.com/@changesets/config@1.5.0/schema.json",
"changelog": [
"@changesets/changelog-github",
{
"repo": "worktile/slate-angular"
}
],
"commit": false,
"linked": [],
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}
2 changes: 1 addition & 1 deletion .coveralls.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
repo_token: 5MUHe1rNtCfuUbqtr7ebinZSzCpYGc5nq
repo_token: 5MUHe1rNtCfuUbqtr7ebinZSzCpYGc5nq
26 changes: 26 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

[*.css]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.json]
indent_size = 2

[*.html]
indent_size = 2

[*.md]
max_line_length = off
trim_trailing_whitespace = false
26 changes: 6 additions & 20 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
{
"root": true,
"ignorePatterns": [
"projects/**/*"
],
"ignorePatterns": ["projects/**/*"],
"overrides": [
{
"files": [
"*.ts"
],
"files": ["*.ts"],
"parserOptions": {
"project": [
"tsconfig.json",
"e2e/tsconfig.json"
],
"project": ["tsconfig.json", "e2e/tsconfig.json"],
"createDefaultProgram": true
},
"extends": [
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates"
],
"extends": ["plugin:@angular-eslint/recommended", "plugin:@angular-eslint/template/process-inline-templates"],
"rules": {
"@angular-eslint/directive-selector": [
"error",
Expand All @@ -36,12 +26,8 @@
}
},
{
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"files": ["*.html"],
"extends": ["plugin:@angular-eslint/template/recommended"],
"rules": {}
}
]
Expand Down
18 changes: 18 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"eslintIntegration": true,
"stylelintIntegration": true,
"tabWidth": 4,
"singleQuote": true,
"semi": true,
"arrowParens": "avoid",
"trailingComma": "none",
"printWidth": 140,
"overrides": [
{
"files": "*.json",
"options": {
"tabWidth": 2
}
}
]
}
41 changes: 14 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,33 @@ Angular view layer for Slate

[中文文档](https://github.com/worktile/slate-angular/blob/master/README.zh-CN.md)


## Introduction

[Slate](https://github.com/ianstormtaylor/slate) is a completely customizable framework for building rich text editors, including the model layer and view layer, but the slate only provides the view layer based on react, slate-angular is a supplement to the slate view layer, to help you use angular to build rich text editor.

slate-angular is inspired by slate-react, and try to keep the style of slate and angular, friendly to Chinese input, start your slate-angular journey.


## Demo

[Try out our live demo](http://slate-angular.ngnice.com)

![editor-preview.png](https://cdn.worktile.com/open-sources/slate-angular/editor-preview.gif)


## Feature

- Support element front and rear cursor scheme
- Support custom component/template rendering Element
- Support custom component/template to render Text
- Support custom component/template rendering Leaf
- Support decorate decoration
- Support void element
- Support element front and rear cursor scheme
- Support custom component/template rendering Element
- Support custom component/template to render Text
- Support custom component/template rendering Leaf
- Support decorate decoration
- Support void element

### Compatible browser

Chrome、Edge、Safari、Firefox、QQ Browser


## Usage

### 1. Install dependencies

```
Expand Down Expand Up @@ -112,7 +109,7 @@ src/styles.scss
padding-left: 10px !important;
border-left: 4px solid #eee;
}
h1,h2,h3 {
margin: 0px;
}
Expand Down Expand Up @@ -158,7 +155,7 @@ export class DemoTextMarkComponent extends BaseTextComponent {
constructor(public elementRef: ElementRef, public renderer2: Renderer2, cdr: ChangeDetectorRef) {
super(elementRef, cdr);
}
applyTextMark() {
this.attributes.forEach(attr => {
this.renderer2.removeAttribute(this.elementRef.nativeElement, attr);
Expand Down Expand Up @@ -286,7 +283,7 @@ export class AppComponent {
}
return null;
}
renderText = (text: any) => {
if (text[MarkTypes.bold] || text[MarkTypes.italic] || text[MarkTypes.code] || text[MarkTypes.underline]) {
return DemoTextMarkComponent;
Expand Down Expand Up @@ -344,11 +341,9 @@ const initialValue = [
```



### 6. Startup basic demo

> Before starting, you need to declare the DemoTextMarkComponent component in NgModule
> Before starting, you need to declare the DemoTextMarkComponent component in NgModule
> You can checkout a [stackblitz implementation of the readme usage](https://stackblitz.com/edit/angular-ivy-pqofah?file=src/app/app.component.ts)
Expand All @@ -358,10 +353,7 @@ const initialValue = [

> Currently, there is no toolbar. You need to add toolbars and processing functions according to your own icon library.
basic usage: [https://github.com/pubuzhixing8/slate-angular-basic](https://github.com/pubuzhixing8/slate-angular-basic)



basic usage: [https://github.com/pubuzhixing8/slate-angular-basic](https://github.com/pubuzhixing8/slate-angular-basic)

## Who is using slate-angular?

Expand All @@ -377,7 +369,6 @@ basic usage: [https://github.com/pubuzhixing8/slate-angular-basic](https://githu
</tr>
</table>


## 💻 Development

```bash
Expand All @@ -391,19 +382,15 @@ npm run build // build new slate-angular
npm run test // run unit tests
```



### Prerequisites

Angular >= 10.*
Angular >= 10.\*

Slate >= 0.63.0


## Contributing

🌟 Stars and 📥 Pull requests to worktile/slate-angular are welcome!

🌟 Stars and 📥 Pull requests to worktile/slate-angular are welcome!

## LICENSE

Expand Down
38 changes: 13 additions & 25 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,35 @@
[coveralls-image]: https://coveralls.io/repos/github/worktile/slate-angular/badge.svg?branch=master
[coveralls-url]: https://coveralls.io/github/worktile/slate-angular


基于 Slate 的 Angular 视图层


## 介绍

[Slate](https://github.com/ianstormtaylor/slate) 是一款架构良好、高扩展性的富文本编辑器框架,包括核心模型和视图层,但slate官方只提供了基于react的视图层,slate-angular 是 slate 视图层实现的补充,可帮助您使用 slate 和 angular 构建富文本编辑器。
[Slate](https://github.com/ianstormtaylor/slate) 是一款架构良好、高扩展性的富文本编辑器框架,包括核心模型和视图层,但 slate 官方只提供了基于 react 的视图层,slate-angular 是 slate 视图层实现的补充,可帮助您使用 slate 和 angular 构建富文本编辑器。

slate-angular 以 slate-react 为灵感,并且尽量保持 slate 和 angular 各自的风格, 对中文输入友好, 开启你的 slate-angular 之旅吧。


## 示例

[Try out our live demo](http://slate-angular.ngnice.com)

![editor-preview.png](https://cdn.worktile.com/open-sources/slate-angular/editor-preview.gif)


### 功能

- 支持Element前后光标方案
- 支持自定义组件/模版渲染Element
- 支持自定义组件/模版渲染Text
- 支持自定义组件/模版渲染Leaf
- 支持decorate装饰
- 支持void元素
- 支持 Element 前后光标方案
- 支持自定义组件/模版渲染 Element
- 支持自定义组件/模版渲染 Text
- 支持自定义组件/模版渲染 Leaf
- 支持 decorate 装饰
- 支持 void 元素

### 兼容浏览器

Chrome、Edge、Safari、Firefox、QQ Browser


## Usage

### 1. 安装依赖

```
Expand Down Expand Up @@ -111,7 +107,7 @@ src/styles.scss
padding-left: 10px !important;
border-left: 4px solid #eee;
}
h1,h2,h3 {
margin: 0px;
}
Expand Down Expand Up @@ -157,7 +153,7 @@ export class DemoTextMarkComponent extends BaseTextComponent {
constructor(public elementRef: ElementRef, public renderer2: Renderer2, cdr: ChangeDetectorRef) {
super(elementRef, cdr);
}
applyTextMark() {
this.attributes.forEach(attr => {
this.renderer2.removeAttribute(this.elementRef.nativeElement, attr);
Expand Down Expand Up @@ -285,7 +281,7 @@ export class AppComponent {
}
return null;
}
renderText = (text: any) => {
if (text[MarkTypes.bold] || text[MarkTypes.italic] || text[MarkTypes.code] || text[MarkTypes.underline]) {
return DemoTextMarkComponent;
Expand Down Expand Up @@ -343,8 +339,6 @@ const initialValue = [
```



### 6. 启动

> 记得在 NgModule 中声明刚刚创建的 DemoTextMarkComponent 组件
Expand All @@ -355,10 +349,7 @@ const initialValue = [

> 现在基础使用中还没有实现工具栏,你可以根据你自己的需要引入图标库或者组件库实现工具栏.
基础使用代码仓储: [https://github.com/pubuzhixing8/slate-angular-basic](https://github.com/pubuzhixing8/slate-angular-basic)



基础使用代码仓储: [https://github.com/pubuzhixing8/slate-angular-basic](https://github.com/pubuzhixing8/slate-angular-basic)

## 谁在使用 slate-angular?

Expand All @@ -374,7 +365,6 @@ const initialValue = [
</tr>
</table>


## 💻 开发

```bash
Expand All @@ -388,14 +378,12 @@ npm run build // 重新构建 slate-angular
npm run test // 执行单元测试
```


## 依赖

Angular >= 10.2.4

Slate >= 0.63.0


## 贡献代码

欢迎 🌟 Stars 和 📥 Pull requests!
欢迎 🌟 Stars 和 📥 Pull requests!
Loading

0 comments on commit 68c234e

Please sign in to comment.