New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bn-wysiwyg

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bn-wysiwyg - npm Package Compare versions

Comparing version 0.1.9 to 0.1.10

src/app/bn-wysiwyg/component/component.const.ts

2

index.ts

@@ -7,2 +7,2 @@ /**

export { BnWysiwygModule } from './src/app/bn-wysiwyg';
export * from './src/app/bn-wysiwyg/component';
export * from './src/app/bn-wysiwyg/component';
{
"name": "bn-wysiwyg",
"version": "0.1.9",
"version": "0.1.10",
"author": "Jan Hommes",

@@ -5,0 +5,0 @@ "description": "This project allows to add a What You See Is What You Get editor to any Angular application.",

@@ -39,3 +39,9 @@ # bn-wysiwyg

### Asigned editor panel
### Toggle edit mode
By default the `bn-wysiwyg` element is editable. You can disable this by setting the editable attribute.
```html
<bn-wysiwyg [editable]="false"></bn-wysiwyg>
```
### Asigne editor panel
The editor panel is assigned to all `<bn-wysiwyg>` on the page. To assign it to a specific one, you need to assign

@@ -42,0 +48,0 @@ it via the `for` attribute. It accepts any valid query selector.

@@ -5,2 +5,3 @@ import { Component, Input, OnInit, OnDestroy, ViewEncapsulation, ElementRef, Output, EventEmitter, OnChanges } from '@angular/core';

import { CommandOptions } from '../commands/core/';
import { ComponentConstants } from '../';

@@ -27,3 +28,2 @@ @Component({

public element = null;

@@ -86,3 +86,3 @@ public isSelected = false;

document.removeEventListener('scroll', this.scrollEvent);
// this.element.setAttribute('contenteditable', null);
// this.element.setAttribute(ComponentConstants.CONTENT_EDITABLE_ATTR_NAME, null);

@@ -184,3 +184,3 @@ if (this.selectionChangedFunctionAdded) {

// set the node (commands can then check itself if they are assigned to this node.tagName and show itself)
if (this.editorService.checkIfParent(event.target, 'contenteditable')) {
if (this.editorService.checkIfParent(event.target, ComponentConstants.CONTENT_EDITABLE_ATTR_NAME)) {
if (this.options.menu === '') {

@@ -197,6 +197,7 @@ this.options.node = event.target;

// show the command panel only if something is selected inside the contentediable area.
this.isSelected = (!selection.isCollapsed && this.editorService.checkIfParent(selection.anchorNode, 'contenteditable'));
this.isSelected = (!selection.isCollapsed &&
this.editorService.checkIfParent(selection.anchorNode, ComponentConstants.CONTENT_EDITABLE_ATTR_NAME));
// To prevent closing if we select a <input> in the command panel.
if (this.editorService.checkIfParent(selection.anchorNode, 'bn-editor')) {
if (this.editorService.checkIfParent(selection.anchorNode, ComponentConstants.EDITOR_SELECTOR)) {
this.isSelected = true;

@@ -222,3 +223,3 @@ }

if (this.for !== null) {
let isAssignedButNoFocus = document.querySelectorAll(this.for + ' .bn-has-focus').length === 0;
let isAssignedButNoFocus = document.querySelectorAll(this.for + ' .' + ComponentConstants.FOCUS_CLASS_NAME).length === 0;
this.options.disabled = isAssignedButNoFocus;

@@ -225,0 +226,0 @@ return isAssignedButNoFocus;

@@ -6,1 +6,3 @@ export * from './editor/editor.component';

export * from './component.const';
import { Component, ViewEncapsulation, Input, ElementRef, OnDestroy, OnChanges, Output, EventEmitter } from '@angular/core';
import { EditorService } from '../../service/editor.service';
import { ComponentConstants } from '../';

@@ -56,3 +57,3 @@ @Component({

public focusOut(event) {
if (!this.editorService.checkIfParent(event.relatedTarget, 'bn-editor')) {
if (!this.editorService.checkIfParent(event.relatedTarget, ComponentConstants.EDITOR_SELECTOR)) {
this.focused = false;

@@ -85,5 +86,5 @@ }

// change selectionmode
if (!this.editorService.checkIfParent(event.target, 'bn-editor')) {
if (!this.editorService.checkIfParent(event.target, ComponentConstants.EDITOR_SELECTOR)) {
let selection = window.getSelection();
this.editorService.setSelectionMode(selection.type === 'Range');
this.editorService.setSelectionMode(selection.type === ComponentConstants.SELECTION_TYPE_RANGE);
}

@@ -90,0 +91,0 @@

@@ -5,2 +5,4 @@ import { Injectable, EventEmitter } from '@angular/core';

import { ComponentConstants } from '../';
@Injectable()

@@ -71,3 +73,3 @@ export class EditorService {

this.stopFocusChange(event);
if (window.getSelection().anchorNode && !this.checkIfParent(window.getSelection().anchorNode, 'bn-editor')) {
if (window.getSelection().anchorNode && !this.checkIfParent(window.getSelection().anchorNode, ComponentConstants.EDITOR_SELECTOR)) {
this.selectedRange = window.getSelection().getRangeAt(0);

@@ -98,3 +100,3 @@ }

let parent = this.getParent(node, attrName);
return typeof parent.tagName !== 'undefined' && parent.tagName.toUpperCase() !== 'BODY';
return typeof parent.tagName !== 'undefined' && parent.tagName.toUpperCase() !== ComponentConstants.ROOT_ELEMENT;
}

@@ -111,3 +113,3 @@

node = node.parentNode;
} while (typeof node.tagName !== 'undefined' && node.tagName.toUpperCase() !== 'BODY');
} while (typeof node.tagName !== 'undefined' && node.tagName.toUpperCase() !== ComponentConstants.ROOT_ELEMENT);
return node;

@@ -114,0 +116,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc