@ebl-vue/editor-full 2.31.20 → 2.31.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ebl-vue/editor-full",
3
- "version": "2.31.20",
3
+ "version": "2.31.22",
4
4
  "type": "module",
5
5
  "author": "lrj525@sina.com",
6
6
  "description": "结构化编辑器",
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="ebl-editor" id="holder"></div>
2
+ <div class="ebl-editor readonly" id="holder"></div>
3
3
  </template>
4
4
  <script lang="ts" setup>
5
5
 
@@ -9,13 +9,13 @@ import EditorJS from '@ebl-vue/editorjs';
9
9
 
10
10
  import { onMounted, onUnmounted, watch, inject } from 'vue';
11
11
  import { toRaw } from 'vue';
12
- import { IEblEditorSettings } from '../../types';
12
+
13
13
 
14
14
  /**
15
15
  * 插件
16
16
  */
17
17
 
18
- import DragDrop from '../../plugins/drag-drop';
18
+
19
19
  import { H1, H2, H3, H4, H5, H6 } from '../../plugins/header';
20
20
  import BlockAlignment from '../../plugins/block-alignment';
21
21
  import Paragraph from '../../plugins/paragraph';
@@ -36,7 +36,7 @@ import ImageTool from "../../plugins/imageTool";
36
36
  import { ImageToolTune } from "../../plugins/imageResizeCrop";
37
37
  import Outline from '../../plugins/outline';
38
38
 
39
- const EblEditorSettings: IEblEditorSettings | undefined = inject("EblEditorSettings");
39
+
40
40
  defineOptions({
41
41
  name: 'EblEditorRender',
42
42
  inheritAttrs: false
@@ -47,21 +47,19 @@ let emits = defineEmits(["onReady", "onChange"]);
47
47
 
48
48
 
49
49
  interface Props {
50
- placeholder: string,
51
50
  data: OutputData,
52
51
  locale: any,
53
- userStore: any,
54
52
  showOutline?: boolean,
53
+ scrollWrap:string
55
54
  }
56
55
 
57
56
  const props = withDefaults(defineProps<Props>(), {
58
-
59
- placeholder: "Enter something",
60
57
  data: ()=>({
61
58
  blocks: []
62
59
  }),
63
60
  locale: {},
64
- showOutline:false
61
+ showOutline: false,
62
+ scrollWrap:''
65
63
  });
66
64
  let editorData=toRaw(props.data);
67
65
  let editorIsReady = false;
@@ -165,8 +163,8 @@ onMounted(() => {
165
163
  types: ".png,.jpeg,.jpg,.gif,.webp",
166
164
  userStore: props.userStore,
167
165
  endpoints: {
168
- byFile: EblEditorSettings?.fileUploadEndpoint,
169
- //byUrl: EblEditorSettings?.urlUploadEndpoint
166
+ byFile: '',
167
+
170
168
  },
171
169
  features: {
172
170
  caption: false,
@@ -204,7 +202,7 @@ onMounted(() => {
204
202
  }
205
203
  //文档大纲
206
204
  if(props.showOutline){
207
- outline = new Outline("holder",editor!);
205
+ outline = new Outline("holder",props.scrollWrap,editor!);
208
206
  outline.render(editorData);
209
207
  }
210
208
 
package/src/index.ts CHANGED
@@ -4,7 +4,7 @@ import './style.css'
4
4
  import { createInstaller } from './installer'
5
5
  import Components from './components';
6
6
  import zhCn from './i18n/zh-cn';
7
- import Editor from './components/Editor/Editor.vue';
7
+ import { EblEditor,EblEditorRender } from './components';
8
8
 
9
9
  const installer = createInstaller(Components);
10
10
  export const install = installer.install;
@@ -17,5 +17,6 @@ export {
17
17
  };
18
18
  export type * from "./types";
19
19
  export {
20
- Editor as EblEditor
20
+ EblEditor,
21
+ EblEditorRender
21
22
  }
@@ -367,7 +367,6 @@ export default class H1 implements BlockTool {
367
367
  */
368
368
  onPaste(event: PasteEvent): void {
369
369
  const detail = event.detail;
370
-
371
370
  if ('data' in detail) {
372
371
  const content = detail.data as HTMLElement;
373
372
  this.data = {
@@ -385,7 +384,7 @@ export default class H1 implements BlockTool {
385
384
  */
386
385
  static get pasteConfig() {
387
386
  return {
388
- tags: ['H1'],
387
+ tags: ['H1','h1'],
389
388
  };
390
389
  }
391
390
 
@@ -1,4 +1,7 @@
1
1
  .ebl-outline{
2
+ position:fixed;
3
+ top:0;
4
+ right:0;
2
5
  padding: 15px 12px;
3
6
  width:280px;
4
7
 
@@ -7,6 +10,7 @@
7
10
  color: #606266;
8
11
  font-size: 14px;
9
12
  padding-bottom: 50px;
13
+ height: calc(100vh - var(--header-height));
10
14
  }
11
15
  .ebl-outline:hover{
12
16
  overflow: auto;
@@ -8,14 +8,15 @@ import { OutputData } from '@ebl-vue/editorjs';
8
8
  export default class Outline{
9
9
  private editor: EditorJS;
10
10
  private holder: HTMLElement;
11
+ private scrollWrap: HTMLElement;
11
12
  /**
12
13
  * 初始化插件
13
14
  * @param {EditorJS} editor - 编辑器实例
14
15
  */
15
- constructor(holderId: string,editor: EditorJS) {
16
+ constructor(holderId: string,scrollWrap:string,editor: EditorJS) {
16
17
  this.editor = editor;
17
18
  this.holder = document.getElementById(holderId) as HTMLElement;
18
-
19
+ this.scrollWrap = (document.getElementById(scrollWrap) ||document.getElementsByTagName(scrollWrap)[0] || document.querySelector(scrollWrap)) as HTMLElement;
19
20
  }
20
21
 
21
22
  public render(data: OutputData) {
@@ -50,7 +51,13 @@ export default class Outline{
50
51
  const block = document.querySelector<HTMLElement>('.codex-editor .ce-block[data-id="' + blockData.id + '"]');
51
52
  if (block) {
52
53
  const top = block.offsetTop;
53
- document.querySelector<HTMLElement>('.codex-editor')?.scrollTo(0, top);
54
+
55
+ if (!this.scrollWrap) {
56
+ document.querySelector<HTMLElement>('.codex-editor')?.scrollTo(0, top);
57
+ } else {
58
+ window.scrollTo(0,top)
59
+ //this.scrollWrap.scrollTo(0, top);
60
+ }
54
61
  }
55
62
 
56
63
  });
@@ -362,7 +362,7 @@ export default class Paragraph {
362
362
  */
363
363
  static get pasteConfig(): PasteConfig {
364
364
  return {
365
- tags: ['P'],
365
+ tags: ['P','div','br'],
366
366
  };
367
367
  }
368
368
 
@@ -100,6 +100,7 @@ export default class Table {
100
100
  this.readOnly = readOnly;
101
101
  this.api = api;
102
102
  this.data = data;
103
+
103
104
  this.config = config;
104
105
 
105
106
  /**
@@ -155,7 +156,8 @@ export default class Table {
155
156
  * Resize table to match config/data size
156
157
  */
157
158
  this.resize();
158
- if(this.data.colWidth.length > 0) {
159
+
160
+ if(this.data.colWidth&&this.data.colWidth.length > 0) {
159
161
  this.colWidthArr = this.data.colWidth;
160
162
  }
161
163
  this.updateColWidth();
@@ -718,7 +720,6 @@ handleDocumentMousedown = (e:MouseEvent) => {
718
720
  */
719
721
  fill() {
720
722
  const data = this.data;
721
-
722
723
  if (data && data.content) {
723
724
  for (let i = 0; i < data.content.length; i++) {
724
725
  for (let j = 0; j < data.content[i].length; j++) {
package/src/style.css CHANGED
@@ -18,23 +18,36 @@
18
18
 
19
19
  }
20
20
  .ebl-editor.outline{
21
- display: flex;
22
- flex-direction: row;
21
+ padding-right: 280px;
23
22
  }
24
23
  .ebl-editor.outline .codex-editor{flex:1;}
25
- .ebl-editor .outline-holder{
24
+ /* .ebl-editor .outline-holder{
26
25
  width: 200px;
27
26
  border-right: 1px solid var(--color-border);
28
27
  overflow: auto;
29
- }
28
+ } */
29
+
30
30
  @media(max-width:1240px){
31
31
  .ebl-outline{
32
32
  display: none;
33
+
34
+ }
35
+ .ebl-editor.outline{
36
+ padding-right: 0;
33
37
  }
34
38
  }
35
- .ce-block__content{
36
- width: var(--content-width);
39
+ @media(min-width:1240px){
40
+ .ebl-editor.readonly .ce-block__content{
41
+ max-width: 100%;
42
+ padding-left: 60px;
43
+ padding-right: 60px;
44
+
45
+ }
46
+
37
47
  }
48
+ /* .ce-block__content{
49
+ width: var(--content-width);
50
+ } */
38
51
  /* @media (min-width: 1050px) {
39
52
  .ce-block__content {
40
53
  max-width: 700px;
@@ -93,8 +106,8 @@
93
106
 
94
107
  /* 滚动条整体部分 */
95
108
  .ebl-editor ::-webkit-scrollbar {
96
- width: 10px; /* 滚动条的宽度 */
97
- height: 12px; /* 滚动条的高度 */
109
+ width: 6px; /* 滚动条的宽度 */
110
+ height: 6px; /* 滚动条的高度 */
98
111
  }
99
112
 
100
113
  /* 滚动条轨道 */
@@ -107,7 +120,7 @@
107
120
  .ebl-editor ::-webkit-scrollbar-thumb {
108
121
  background: #C0C0C0; /* 滑块颜色 */
109
122
  border-radius: 10px; /* 滑块圆角 */
110
- border: 2px solid #fff; /* 滑块边框 */
123
+ border: 1px solid #fff; /* 滑块边框 */
111
124
  }
112
125
 
113
126
  /* 滑块悬停时 */