Skip to content

Commit

Permalink
fix: remove nanoid dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
sibiraj-s committed Apr 3, 2024
1 parent cfa0d43 commit 3a589e1
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 26 deletions.
19 changes: 0 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Expand Up @@ -71,7 +71,6 @@
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"lint-staged": "^15.2.2",
"nanoid": "^5.0.6",
"ng-packagr": "^17.1.0",
"prettier": "^3.2.5",
"prettier-plugin-astro": "^0.13.0",
Expand Down
1 change: 0 additions & 1 deletion projects/ngx-editor/ng-package.json
Expand Up @@ -13,7 +13,6 @@
"prosemirror-commands",
"prosemirror-history",
"prosemirror-inputrules",
"nanoid",
"@floating-ui/core",
"@floating-ui/dom",
"@types/trusted-types"
Expand Down
1 change: 0 additions & 1 deletion projects/ngx-editor/package.json
Expand Up @@ -25,7 +25,6 @@
"@floating-ui/core": "1.6.0",
"@floating-ui/dom": "1.6.3",
"@types/trusted-types": "~2.0.7",
"nanoid": "^5.0.6",
"prosemirror-commands": "1.5.2",
"prosemirror-history": "1.3.2",
"prosemirror-inputrules":"1.4.0",
Expand Down
Expand Up @@ -6,7 +6,7 @@ import { AbstractControl, FormControl, FormGroup, Validators } from '@angular/fo
import { NodeSelection } from 'prosemirror-state';
import { EditorView } from 'prosemirror-view';
import { Observable, Subscription } from 'rxjs';
import { nanoid } from 'nanoid';
import { uniq } from 'ngx-editor/utils';

import { NgxEditorService } from '../../../editor.service';
import { MenuService } from '../menu.service';
Expand All @@ -21,7 +21,7 @@ import { HTML } from '../../../trustedTypesUtil';
export class ImageComponent implements OnInit, OnDestroy {
showPopup = false;
isActive = false;
private componentId = nanoid();
private componentId = uniq();
private updateSubscription: Subscription;

form = new FormGroup({
Expand Down
Expand Up @@ -5,12 +5,12 @@ import {
import { AbstractControl, FormControl, FormGroup, Validators } from '@angular/forms';
import { EditorView } from 'prosemirror-view';
import { Observable, Subscription } from 'rxjs';
import { uniq } from 'ngx-editor/utils';

import { NgxEditorService } from '../../../editor.service';
import { MenuService } from '../menu.service';
import { Link as LinkCommand } from '../MenuCommands';
import { HTML } from '../../../trustedTypesUtil';
import { nanoid } from 'nanoid';

@Component({
selector: 'ngx-link',
Expand All @@ -22,7 +22,7 @@ export class LinkComponent implements OnInit, OnDestroy {
showPopup = false;
isActive = false;
canExecute = true;
private componentId = nanoid();
private componentId = uniq();
form: FormGroup;

private editorView: EditorView;
Expand Down
1 change: 1 addition & 0 deletions projects/ngx-editor/utils/public_api.ts
@@ -1,3 +1,4 @@
export { default as isNil } from './isNil';
export { default as toStyleString } from './toStyleString';
export { default as NgxEditorError } from './error';
export { default as uniq } from './uniq';
7 changes: 7 additions & 0 deletions projects/ngx-editor/utils/uniq.ts
@@ -0,0 +1,7 @@
const uniq = (): string => {
const timeStamp = Date.now().toString(36);
const random = Math.random().toString(36).substring(2, 7);
return `${timeStamp}${random}`;
};

export default uniq;

0 comments on commit 3a589e1

Please sign in to comment.