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

Changed Theme for playground app #59

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
32 changes: 32 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"pins" : [
{
"identity" : "swift-cmark",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-cmark.git",
"state" : {
"branch" : "gfm",
"revision" : "2c47322cb32cbed555f13bf5cbfaa488cc30a785"
}
},
{
"identity" : "swift-markdown",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-markdown.git",
"state" : {
"branch" : "main",
"revision" : "907674c2ae2d24c32fba50101821b1a7fdd291e2"
}
},
{
"identity" : "swiftsoup",
"kind" : "remoteSourceControl",
"location" : "https://github.com/scinfu/SwiftSoup.git",
"state" : {
"revision" : "028487d4a8a291b2fe1b4392b5425b6172056148",
"version" : "2.7.2"
}
}
],
"version" : 2
}
6 changes: 3 additions & 3 deletions Playground/LexicalPlayground.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,9 @@
productName = LexicalInlineImagePlugin;
};
3C48FEE32B04F2C5009BBFA2 /* LexicalMarkdown */ = {
isa = XCSwiftPackageProductDependency;
productName = LexicalMarkdown;
};
isa = XCSwiftPackageProductDependency;
productName = LexicalMarkdown;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 0656CF6D29D1E438009CA08F /* Project object */;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"colors" : [
{
"color" : {
"platform" : "universal",
"reference" : "systemRedColor"
},
"idiom" : "universal"
}
],
Expand Down
12 changes: 11 additions & 1 deletion Playground/LexicalPlayground/ToolbarPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,17 @@ public class ToolbarPlugin: Plugin {
let insertImage = UIBarButtonItem(image: UIImage(systemName: "photo"), menu: self.imageMenu)
self.insertImageButton = insertImage

toolbar.items = [undo, redo, paragraph, styling, link, decreaseIndent, increaseIndent, insertImage]
let spacer = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)

toolbar.items = [undo, spacer,
redo, spacer,
paragraph, spacer,
styling, spacer,
link, spacer,
decreaseIndent, spacer,
increaseIndent, spacer,
insertImage]
toolbar.barTintColor = .systemGray5
}

private enum ParagraphMenuSelectedItemType {
Expand Down
8 changes: 7 additions & 1 deletion Playground/LexicalPlayground/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ class ViewController: UIViewController, UIToolbarDelegate {
let theme = Theme()
theme.indentSize = 40.0
theme.link = [
.foregroundColor: UIColor.systemBlue,
.foregroundColor: UIColor.link,
]
theme.code = [
.font: UIFont.monospacedSystemFont(ofSize: 16.0, weight: .regular),
]

let editorConfig = EditorConfig(theme: theme, plugins: [toolbarPlugin, listPlugin, hierarchyPlugin, imagePlugin, linkPlugin, editorHistoryPlugin])
Expand Down Expand Up @@ -76,6 +79,9 @@ class ViewController: UIViewController, UIToolbarDelegate {
y: toolbar.frame.maxY,
width: view.bounds.width,
height: view.bounds.height - toolbar.frame.maxY - safeAreaInsets.bottom - hierarchyViewHeight)

lexicalView.textViewBackgroundColor = .systemGray6

hierarchyView.frame = CGRect(x: 0,
y: lexicalView.frame.maxY,
width: view.bounds.width,
Expand Down