Skip to content

Commit 2bdf459

Browse files
committed
Merge branch 'main' into parsing-2
2 parents 41ba5a5 + 849e18b commit 2bdf459

File tree

6 files changed

+85
-3
lines changed

6 files changed

+85
-3
lines changed

.github/workflows/dependabot.yaml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Dependabot auto-merge
2+
on: pull_request
3+
4+
permissions:
5+
contents: write
6+
pull-requests: write
7+
8+
jobs:
9+
dependabot:
10+
runs-on: ubuntu-latest
11+
if: github.actor == 'dependabot[bot]'
12+
steps:
13+
- name: Dependabot metadata
14+
id: metadata
15+
uses: dependabot/fetch-metadata@v2
16+
with:
17+
github-token: "${{ secrets.GITHUB_TOKEN }}"
18+
- name: Enable auto-merge for Dependabot PRs
19+
if: steps.metadata.outputs.update-type == 'version-update:semver-patch'
20+
run: gh pr merge --auto --merge "$PR_URL"
21+
env:
22+
PR_URL: ${{github.event.pull_request.html_url}}
23+
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}

blocks/edit/da-editor/da-editor.css

+8
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,14 @@ span.ProseMirror-menuseparator {
260260
background: url('/blocks/edit/img/Smock_TextItalic_18_N.svg') center / 18px no-repeat var(--editor-btn-bg-color);
261261
}
262262

263+
.edit-sup {
264+
background: url('/blocks/edit/img/Smock_TextSuperscript_18_N.svg') center / 18px no-repeat #EFEFEF;
265+
}
266+
267+
.edit-sub {
268+
background: url('/blocks/edit/img/Smock_TextSubscript_18_N.svg') center / 18px no-repeat #EFEFEF;
269+
}
270+
263271
.edit-link {
264272
background: url('/blocks/edit/img/Smock_Link_18_N.svg') center / 18px no-repeat var(--editor-btn-bg-color);
265273
}
Loading
Loading

blocks/edit/prose/index.js

+20-3
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,33 @@ import { addLocNodes, getLocClass } from './loc-utils.js';
3636

3737
const DA_ORIGIN = getDaAdmin();
3838

39+
function addCustomMarks(marks) {
40+
const sup = {
41+
parseDOM: [{ tag: 'sup' }, { clearMark: (m) => m.type.name === 'sup' }],
42+
toDOM() { return ['sup', 0]; },
43+
};
44+
45+
const sub = {
46+
parseDOM: [{ tag: 'sub' }, { clearMark: (m) => m.type.name === 'sub' }],
47+
toDOM() { return ['sub', 0]; },
48+
};
49+
50+
const contextHighlight = { toDOM: () => ['span', { class: 'highlighted-context' }, 0] };
51+
52+
return marks
53+
.addToEnd('sup', sup)
54+
.addToEnd('sub', sub)
55+
.addToEnd('contextHighlightingMark', contextHighlight);
56+
}
57+
3958
// Note: until getSchema() is separated in its own module, this function needs to be kept in-sync
4059
// with the getSchema() function in da-collab src/collab.js
4160
export function getSchema() {
4261
const { marks, nodes: baseNodes } = baseSchema.spec;
4362
const withLocNodes = addLocNodes(baseNodes);
4463
const withListnodes = addListNodes(withLocNodes, 'block+', 'block');
4564
const nodes = withListnodes.append(tableNodes({ tableGroup: 'block', cellContent: 'block+' }));
46-
const contextHighlightingMark = { toDOM: () => ['span', { class: 'highlighted-context' }, 0] };
47-
const customMarks = marks.addToEnd('contextHighlightingMark', contextHighlightingMark);
48-
return new Schema({ nodes, marks: customMarks });
65+
return new Schema({ nodes, marks: addCustomMarks(marks) });
4966
}
5067

5168
let sendUpdates = false;

blocks/edit/prose/plugins/menu.js

+10
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,16 @@ function getTextBlocks(marks, nodes) {
281281
label: 'I',
282282
class: 'edit-italic',
283283
}),
284+
markItem(marks.sup, {
285+
title: 'Toggle superscript',
286+
label: 'SUP',
287+
class: 'edit-sup',
288+
}),
289+
markItem(marks.sub, {
290+
title: 'Toggle subscript',
291+
label: 'SUB',
292+
class: 'edit-sub',
293+
}),
284294
item('separator', null, 'separator'),
285295
blockTypeItem(nodes.paragraph, {
286296
title: 'Change to paragraph',

0 commit comments

Comments
 (0)