Skip to content
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

habe noch einen fehler gefunden :-( #3

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

18 changes: 8 additions & 10 deletions Resources/Private/Footnotes/src/footnotePlugin.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import toMap from '@ckeditor/ckeditor5-utils/src/tomap';
import {Command, Plugin, UpcastConverters, DowncastConverters, ModelRange as Range, ModelPosition as Position} from 'ckeditor5-exports';
const {downcastAttributeToElement} = DowncastConverters;
const {upcastElementToAttribute} = UpcastConverters;
import {Command, Plugin, ModelRange as Range, ModelPosition as Position} from 'ckeditor5-exports';

const FOOTNOTE = 'footnote';

Expand All @@ -19,7 +17,7 @@ function _findBound(position, value, lookBack) {
node = lookBack ? node.previousSibling : node.nextSibling;
}

return lastNode ? Position.createAt(lastNode, lookBack ? 'before' : 'after') : position;
return lastNode ? Position._createAt(lastNode, lookBack ? 'before' : 'after') : position;
}

class FootnoteCommand extends Command {
Expand Down Expand Up @@ -67,7 +65,7 @@ class FootnoteCommand extends Command {
attributes.set(this.attributeKey, value);
const node = writer.createText(value, attributes);
writer.insert(node, position);
writer.setSelection(Range.createOn(node));
writer.setSelection(Range._createOn(node));
}
} else {
const ranges = model.schema.getValidRanges(selection.getRanges(), this.attributeKey);
Expand All @@ -91,12 +89,12 @@ export default class Footnote extends Plugin {
init() {
const editor = this.editor;
editor.model.schema.extend('$text', {allowAttributes: FOOTNOTE});
editor.conversion.for('downcast').add(downcastAttributeToElement({
editor.conversion.for('downcast').attributeToElement({
model: FOOTNOTE,
view: (footnote, writer) => writer.createAttributeElement('span', {'data-footnote': footnote})
}));
editor.conversion.for('upcast')
.add(upcastElementToAttribute({
});

editor.conversion.for('upcast').elementToAttribute({
view: {
name: 'span',
attributes: {
Expand All @@ -107,7 +105,7 @@ export default class Footnote extends Plugin {
key: FOOTNOTE,
value: viewElement => viewElement.getAttribute('data-footnote')
}
}));
});
editor.commands.add(FOOTNOTE, new FootnoteCommand(this.editor, FOOTNOTE));
}
}
Loading