-
Notifications
You must be signed in to change notification settings - Fork 46
Limit options and add setting to editor #5432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 15 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
e5b28b9
Limit options and add check
Elblinator 4d61947
Add setting
Elblinator b4c9dff
Remove testing trainig wheel, ups
Elblinator 175cbea
Merge branch 'main' into 5418-limit-editor
Elblinator 2f9eca7
Add second setting and activate settings
Elblinator 510c2fc
restrict editor
Elblinator 9d016d3
fix isEditorLimited
Elblinator 2ccafc9
intermediate results
Elblinator 1c960f1
intermediate results 2
Elblinator 340b51b
result
Elblinator 694291e
first part of CR
Elblinator a2bb97d
change function + call
Elblinator f52766c
Add types
Elblinator 6ac5a58
Change part of the Setting/Permission check
Elblinator 40d53cc
linter
Elblinator 05523e5
cr
Elblinator 24ec329
Change validation
Elblinator d82b8f2
Merge remote-tracking branch 'upstream/main' into 5418-limit-editor
Elblinator 778ea10
setting placment
Elblinator dc55c6a
CRs
Elblinator 2364dee
Linter
Elblinator c8c1d02
Class
Elblinator 2928f6a
Merge branch 'main' into 5418-limit-editor
Elblinator File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...ite/pages/meetings/pages/motions/components/motion-editor/motion-editor.component.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
|
||
| import { MotionEditorComponent } from './motion-editor.component'; | ||
|
|
||
| xdescribe(`MotionEditor`, () => { | ||
| let component: MotionEditorComponent; | ||
| let fixture: ComponentFixture<MotionEditorComponent>; | ||
|
|
||
| beforeEach(async () => { | ||
| await TestBed.configureTestingModule({ | ||
| declarations: [MotionEditorComponent] | ||
| }).compileComponents(); | ||
| }); | ||
|
|
||
| beforeEach(() => { | ||
| fixture = TestBed.createComponent(MotionEditorComponent); | ||
| component = fixture.componentInstance; | ||
| fixture.detectChanges(); | ||
| }); | ||
|
|
||
| it(`should create`, () => { | ||
| expect(component).toBeTruthy(); | ||
| }); | ||
| }); |
87 changes: 87 additions & 0 deletions
87
...app/site/pages/meetings/pages/motions/components/motion-editor/motion-editor.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| import { AfterViewInit, Component, forwardRef, inject } from '@angular/core'; | ||
| import { NG_VALUE_ACCESSOR } from '@angular/forms'; | ||
| import OfficePaste from '@intevation/tiptap-extension-office-paste'; | ||
| import { Extension } from '@tiptap/core'; | ||
| import { Bold } from '@tiptap/extension-bold'; | ||
| import { Document } from '@tiptap/extension-document'; | ||
| import { HardBreak } from '@tiptap/extension-hard-break'; | ||
| import { Heading } from '@tiptap/extension-heading'; | ||
| import { Italic } from '@tiptap/extension-italic'; | ||
| import { Paragraph } from '@tiptap/extension-paragraph'; | ||
| import { Text } from '@tiptap/extension-text'; | ||
| import { TextAlign } from '@tiptap/extension-text-align'; | ||
| import { UndoRedo } from '@tiptap/extensions'; | ||
| import { Permission } from 'src/app/domain/definitions/permission'; | ||
| import { MeetingSettingsService } from 'src/app/site/pages/meetings/services/meeting-settings.service'; | ||
| import { OperatorService } from 'src/app/site/services/operator.service'; | ||
|
|
||
| import { EditorComponent } from '../../../../../../../ui/modules/editor/components/editor/editor.component'; | ||
| import { | ||
| OsSplit, | ||
| OsSplitBulletList, | ||
| OsSplitListItem, | ||
| OsSplitOrderedList | ||
| } from '../../../../../../../ui/modules/editor/components/editor/extensions/os-split'; | ||
| import { TextStyle } from '../../../../../../../ui/modules/editor/components/editor/extensions/text-style'; | ||
|
|
||
| @Component({ | ||
| selector: `os-motion-editor`, | ||
|
|
||
| templateUrl: `../../../../../../../ui/modules/editor/components/editor/editor.component.html`, | ||
| styleUrls: [`../../../../../../../ui/modules/editor/components/editor/editor.component.scss`], | ||
| providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => MotionEditorComponent), multi: true }], | ||
| standalone: false | ||
| }) | ||
| export class MotionEditorComponent extends EditorComponent implements AfterViewInit { | ||
| private nonManagerSetting = false; | ||
| private managerSetting = false; | ||
|
|
||
| private canManage = false; | ||
|
|
||
| public override isNormalEditor = false; | ||
|
|
||
| protected operator: OperatorService = inject(OperatorService); | ||
|
|
||
| public constructor(private meetingSettingsService: MeetingSettingsService) { | ||
| super(); | ||
|
|
||
| this.nonManagerSetting = this.meetingSettingsService.instant( | ||
| `motions_enable_restricted_editor_for_non_manager` | ||
| ); | ||
| this.managerSetting = this.meetingSettingsService.instant(`motions_enable_restricted_editor_for_manager`); | ||
|
|
||
| this.canManage = this.operator.hasPerms(Permission.motionCanManage); | ||
| } | ||
|
|
||
| public override getExtensions(): Extension[] { | ||
| if ((this.canManage && this.managerSetting) || (!this.canManage && this.nonManagerSetting)) { | ||
| return [ | ||
| OfficePaste, | ||
| // Nodes | ||
| Document, | ||
| HardBreak, | ||
| Heading, | ||
| OsSplitBulletList, | ||
| OsSplitOrderedList, | ||
| OsSplitListItem, | ||
| Paragraph, | ||
| Text, | ||
|
|
||
| // Marks | ||
| Bold, | ||
| Italic, | ||
| TextStyle, | ||
|
|
||
| // Extensions | ||
| UndoRedo, | ||
| TextAlign.configure({ | ||
| types: [`heading`, `paragraph`] | ||
| }), | ||
| OsSplit, | ||
| this.createExtensionFunctions() | ||
| ]; | ||
| } else { | ||
| return super.getExtensions(); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ail/pages/motion-view/components/motion-final-version/motion-final-version.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.