Skip to content

Commit

Permalink
ucfopen#2095 Simplifies excerpt obonode's citation area, removes unus…
Browse files Browse the repository at this point in the history
…ed logic left over from older iterations of the excerpt obonode design, changes 'Box / Excerpt' to just 'Excerpt' in insert menu and makes corresponding adjustment to visual editor tutorial.
  • Loading branch information
FrenjaminBanklin committed Jun 23, 2023
1 parent 942c448 commit 8a05b01
Show file tree
Hide file tree
Showing 17 changed files with 179 additions and 403 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3483,7 +3483,7 @@
"id": "889429ed-f7ee-4a61-940a-4d4b6d8089e7",
"type": "ObojoboDraft.Pages.Page",
"content": {
"title": "Box/Excerpt"
"title": "Excerpt"
},
"children": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,10 @@ Object {
Object {
"children": Array [
Object {
"children": Array [
Object {
"text": "citation text",
},
],
"content": Object {
"align": "center",
"hangingIndent": 0,
"indent": 0,
},
"subtype": "ObojoboDraft.Chunks.Excerpt.CitationLine",
"type": "ObojoboDraft.Chunks.Excerpt",
"text": "citation text",
},
],
"content": Object {
"hangingIndent": 0,
"indent": 0,
},
"content": Object {},
"subtype": "ObojoboDraft.Chunks.Excerpt.CitationText",
"type": "ObojoboDraft.Chunks.Excerpt",
},
Expand Down Expand Up @@ -71,24 +57,10 @@ Object {
Object {
"children": Array [
Object {
"children": Array [
Object {
"text": "Citation Text",
},
],
"content": Object {
"align": "center",
"hangingIndent": 0,
"indent": 0,
},
"subtype": "ObojoboDraft.Chunks.Excerpt.CitationLine",
"type": "ObojoboDraft.Chunks.Excerpt",
"text": "Citation Text",
},
],
"content": Object {
"hangingIndent": 0,
"indent": 0,
},
"content": Object {},
"subtype": "ObojoboDraft.Chunks.Excerpt.CitationText",
"type": "ObojoboDraft.Chunks.Excerpt",
},
Expand All @@ -109,9 +81,7 @@ Object {
"type": "OboNode",
},
],
"content": Object {
"citation": "Citation Line",
},
"content": Object {},
"id": "mockKey",
"type": "ObojoboDraft.Chunks.Excerpt",
}
Expand All @@ -125,7 +95,6 @@ Object {
},
],
"content": Object {
"citation": "Citation Line",
"triggers": "mock-triggers",
},
"id": "mockKey",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Excerpt editor renderNode renders excerpt citation line when passed 1`] = `
<Line
attributes={
Object {
"dummy": "dummyData",
}
}
dummy="dummyData"
element={
Object {
"content": Object {},
"subtype": "ObojoboDraft.Chunks.Excerpt.CitationLine",
"type": "ObojoboDraft.Chunks.Excerpt",
}
}
/>
`;

exports[`Excerpt editor renderNode renders excerpt citation text when passed 1`] = `
<Citation
<cite
attributes={
Object {
"dummy": "dummyData",
Expand All @@ -28,6 +10,11 @@ exports[`Excerpt editor renderNode renders excerpt citation text when passed 1`]
dummy="dummyData"
element={
Object {
"children": Array [
Object {
"text": "citation text",
},
],
"content": Object {},
"subtype": "ObojoboDraft.Chunks.Excerpt.CitationText",
"type": "ObojoboDraft.Chunks.Excerpt",
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import './edge-controls.scss'

import React from 'react'

const EdgeControls = ({ position, edges, selectedEdge, onChangeEdge }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ $lighter-blue: lighten($color-obojobo-blue, 60%);
}

&.is-edge-fade::after {
background-image: url('../../images/icon-fade-edge.png');
background-image: url('../images/icon-fade-edge.png');
}

&.is-edge-jagged::after {
background-image: url('../../images/icon-jagged-edge.png');
background-image: url('../images/icon-jagged-edge.png');
}
}

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

15 changes: 4 additions & 11 deletions packages/obonode/obojobo-chunks-excerpt/converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import withoutUndefined from 'obojobo-document-engine/src/scripts/common/util/wi
const EXCERPT_NODE = 'ObojoboDraft.Chunks.Excerpt'
const EXCERPT_CONTENT_NODE = 'ObojoboDraft.Chunks.Excerpt.ExcerptContent'
const CITE_TEXT_NODE = 'ObojoboDraft.Chunks.Excerpt.CitationText'
const CITE_LINE_NODE = 'ObojoboDraft.Chunks.Excerpt.CitationLine'

/**
* Generates an Obojobo Excerpt Node from a Slate node.
* Copies the id, type, triggers, and condenses ExcerptLine children and their
Expand All @@ -20,7 +20,7 @@ const slateToObo = node => {
// but it's only ever going to be a single line of centered text
// so there's really no reason to go to the trouble here
// this seems a bit magical, though - may be a convenience function somewhere?
const citationText = node.children[1].children[0].children[0].text
const citationText = node.children[1].children[0].text

return {
id: node.id,
Expand Down Expand Up @@ -72,15 +72,8 @@ const oboToSlate = node => {
slateNode.children.push({
type: EXCERPT_NODE,
subtype: CITE_TEXT_NODE,
content: { indent: 0, hangingIndent: 0 },
children: [
{
type: EXCERPT_NODE,
subtype: CITE_LINE_NODE,
content: { indent: 0, hangingIndent: 0, align: 'center' },
children: [{ text: node.content.citation }]
}
]
content: {},
children: [{ text: node.content.citation }]
})

delete slateNode.content.excerpt
Expand Down
1 change: 1 addition & 0 deletions packages/obonode/obojobo-chunks-excerpt/converter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ describe('Excerpt Converter', () => {
}
}
const slateNode = Converter.oboToSlate(oboNode)
expect(slateNode.children[1].children).toEqual([{ text: 'Citation Text' }])

expect(slateNode).toMatchSnapshot()
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ $lighter-blue: lighten($color-obojobo-blue, 60%);
}
}

> blockquote .delete-button {
// this is a bit of a hack to force the placeholder to do what we want
// but it's easier than fixing it 'properly'
> blockquote > cite span::before {
transform: translateX(-50%);
}

> blockquote > .excerpt-content > .delete-button {
position: absolute;
left: auto;
top: 0;
Expand Down
Loading

0 comments on commit 8a05b01

Please sign in to comment.