@textbus/core
Advanced tools
Comparing version 2.0.0-alpha.0 to 2.0.0-alpha.1
@@ -55,5 +55,2 @@ import { Observable } from '@tanbo/stream'; | ||
} | ||
export interface ContextMenuEventData { | ||
index: number; | ||
} | ||
export interface ContextMenuItem { | ||
@@ -71,3 +68,4 @@ iconClasses?: string[]; | ||
onDelete: (event: TBEvent<DeleteEventData>) => void; | ||
onContextMenu: (event: TBEvent<ContextMenuEventData>) => ContextMenuItem[]; | ||
onSlotRemove: (event: TBEvent<null>) => void; | ||
onContextMenu: (event: TBEvent<null>) => ContextMenuItem[]; | ||
onViewChecked: () => void; | ||
@@ -80,6 +78,7 @@ onViewInit: () => void; | ||
export declare function invokeListener(target: ComponentInstance, eventType: 'onDelete', data: TBEvent<DeleteEventData>): void; | ||
export declare function invokeListener(target: ComponentInstance, eventType: 'onSlotRemove', data: TBEvent<null>): void; | ||
export declare function invokeListener(target: ComponentInstance, eventType: 'onEnter', data: TBEvent<EnterEventData>): void; | ||
export declare function invokeListener(target: ComponentInstance, eventType: 'onInsert', data: TBEvent<InsertEventData>): void; | ||
export declare function invokeListener(target: ComponentInstance, eventType: 'onInserted', data: TBEvent<InsertEventData>): void; | ||
export declare function invokeListener(target: ComponentInstance, eventType: 'onContextMenu', data: TBEvent<ContextMenuEventData>): void; | ||
export declare function invokeListener(target: ComponentInstance, eventType: 'onContextMenu', data: TBEvent<null>): void; | ||
export declare function invokeListener(target: ComponentInstance, eventType: 'onPaste', data: TBEvent<PasteEventData>): void; | ||
@@ -90,2 +89,3 @@ export declare function onPaste(listener: EventTypes['onPaste']): void; | ||
export declare function onViewInit(listener: EventTypes['onViewInit']): void; | ||
export declare function onSlotRemove(listener: EventTypes['onSlotRemove']): void; | ||
export declare function onDelete(listener: EventTypes['onDelete']): void; | ||
@@ -92,0 +92,0 @@ export declare function onEnter(listener: EventTypes['onEnter']): void; |
@@ -215,2 +215,7 @@ import { Subject } from '@tanbo/stream'; | ||
} | ||
export function onSlotRemove(listener) { | ||
if (rendererContext) { | ||
rendererContext.add('onSlotRemove', listener); | ||
} | ||
} | ||
export function onDelete(listener) { | ||
@@ -217,0 +222,0 @@ if (rendererContext) { |
@@ -204,2 +204,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
} | ||
else { | ||
let isPreventDefault = true; | ||
const event = new TBEvent(slot, null, () => { | ||
isPreventDefault = false; | ||
}); | ||
invokeListener(parentComponent, 'onSlotRemove', event); | ||
if (!isPreventDefault) { | ||
parentComponent.slots.remove(slot); | ||
} | ||
} | ||
} | ||
@@ -466,3 +476,10 @@ } | ||
const index = parentComponent.slots.indexOf(parentSlot); | ||
parentComponent.slots.remove(parentSlot); | ||
let isPreventDefault = true; | ||
const event = new TBEvent(parentSlot, null, () => { | ||
isPreventDefault = false; | ||
}); | ||
invokeListener(parentComponent, 'onSlotRemove', event); | ||
if (!isPreventDefault) { | ||
parentComponent.slots.remove(parentSlot); | ||
} | ||
if (index === 0) { | ||
@@ -469,0 +486,0 @@ const p = parentComponent.parent; |
@@ -37,3 +37,3 @@ import { Content } from './content'; | ||
if (typeof newState === 'object') { | ||
Object.assign(newState); | ||
Object.freeze(newState); | ||
} | ||
@@ -40,0 +40,0 @@ const oldState = this.state; |
@@ -37,3 +37,3 @@ import { Observable } from '@tanbo/stream'; | ||
toArray(): T[]; | ||
clear(): void; | ||
clean(): void; | ||
insert(...slots: T[]): void; | ||
@@ -40,0 +40,0 @@ retain(index: number): void; |
@@ -71,3 +71,3 @@ import { Subject } from '@tanbo/stream'; | ||
} | ||
clear() { | ||
clean() { | ||
this.retain(this.length); | ||
@@ -74,0 +74,0 @@ this.delete(this.length); |
@@ -0,1 +1,2 @@ | ||
import 'reflect-metadata'; | ||
export * from './_utils/make-error'; | ||
@@ -2,0 +3,0 @@ export * from './foundation/_api'; |
@@ -0,1 +1,2 @@ | ||
import 'reflect-metadata'; | ||
export * from './_utils/make-error'; | ||
@@ -2,0 +3,0 @@ export * from './foundation/_api'; |
{ | ||
"name": "@textbus/core", | ||
"version": "2.0.0-alpha.0", | ||
"version": "2.0.0-alpha.1", | ||
"description": "TextBus is a rich text editor and framework that is highly customizable and extensible to achieve rich wysiwyg effects.", | ||
@@ -42,3 +42,3 @@ "main": "./bundles/public-api.js", | ||
}, | ||
"gitHead": "b70fb33fbc920a26042ddeb1289ce95c129b7c15" | ||
"gitHead": "bda784bf95eebf69e1e6934f3d96348ce9c4bb2a" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
352941
5089
0