Skip to content

Commit

Permalink
feat: update sample
Browse files Browse the repository at this point in the history
work on issue #22
  • Loading branch information
bsorrentino committed Aug 21, 2023
1 parent 10dd331 commit 3ba1429
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 27 deletions.
43 changes: 27 additions & 16 deletions PlantUMLEditor/Example/CodeViewerExample-iOS/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,36 @@ import CodeViewer

struct ContentView: View {

@State private var text = """
@startuml
participant A
@enduml
@State private var text =
"""
"""

var body: some View {
CodeViewer(
content: $text,
mode: .dot,
darkTheme: .dracula,
lightTheme: .chrome,
isReadOnly: false,
fontSize: 13
)


NavigationView {

CodeViewer(
content: $text,
mode: .dot,
darkTheme: .monokai,
lightTheme: .chrome,
isReadOnly: false,
fontSize: 15
)
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
Button(action: {
print("Pushed reload!")
NotificationCenter.default.post(name: NSNotification.Name("reload"), object: nil)
}) {
Image(systemName: "arrow.clockwise")
Text("Reload")
}
}
}

}
.navigationViewStyle(.stack)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"CodeViewerExample-iOS/Preview Content\"";
DEVELOPMENT_TEAM = W777S7V8TN;
DEVELOPMENT_TEAM = 48J595L9BX;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = "CodeViewerExample-iOS/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
Expand All @@ -296,7 +296,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"CodeViewerExample-iOS/Preview Content\"";
DEVELOPMENT_TEAM = W777S7V8TN;
DEVELOPMENT_TEAM = 48J595L9BX;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = "CodeViewerExample-iOS/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
Expand Down
39 changes: 30 additions & 9 deletions PlantUMLEditor/ace-builds/bundle.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import fs from "fs-extra";
import path from "path";

const srcPath = path.join('.', 'node_modules', 'ace-builds', 'src-min-noconflict' )

// const targetPath = "dist";
const targetPath = path.join( '..', 'Sources', 'CodeViewer', 'Resources', 'ace.bundle')

const copyFiles = async () => {
const copyModesAndSnippet = async () => {
const srcPath = path.join('.', 'node_modules', 'ace-builds', 'src-noconflict' )

const filter = async (src, dest) => {

Expand All @@ -17,18 +18,38 @@ const copyFiles = async () => {

const fileName = path.basename(src)

return fileName.startsWith('ext-') ||
fileName.startsWith('theme-') ||
fileName === 'mode-plain_text.js' ||
fileName === 'mode-dot.js' ||
fileName === 'worker-base.js' ||
fileName === 'ace.js' ||
fileName === 'plain_text.js' ||
return fileName === 'mode-plain_text.js' ||
fileName === 'mode-dot.js' ||
fileName === 'plain_text.js' ||
fileName === 'dot.js'
;
}
return fs.copy( srcPath, targetPath, { overwrite: true, filter: filter, recursive: true } )

}

const copyFiles = async () => {
const srcPath = path.join('.', 'node_modules', 'ace-builds', 'src-noconflict' )

const filter = async (src, dest) => {

const stat = await fs.lstat(src);

if(stat.isDirectory()) {
return true;
}

const fileName = path.basename(src)

return fileName === 'ace.js' ||
fileName === 'worker-base.js' ||
fileName.startsWith('ext-') ||
fileName.startsWith('theme-')
;
}
return fs.copy( srcPath, targetPath, { overwrite: true, filter: filter, recursive: false } )
}

copyFiles()
.then( copyModesAndSnippet )
.then(() => console.info( "files copied!") )

0 comments on commit 3ba1429

Please sign in to comment.