File tree Expand file tree Collapse file tree 6 files changed +14
-26
lines changed Expand file tree Collapse file tree 6 files changed +14
-26
lines changed Original file line number Diff line number Diff line change 1
1
# Milkdown 💖 VSCode
2
2
3
- Use [ Milkdown ] ( https://saul-mirone.github.io/milkdown/#/ ) in your favorite editor to edit markdown .
3
+ Edit markdown in a WYSIWYG way, powered by [ milkdown ] ( https://saul-mirone.github.io/milkdown/#/ ) .
4
4
5
5
## Install
6
6
Original file line number Diff line number Diff line change 4
4
"icon" : " logo.png" ,
5
5
"displayName" : " Milkdown" ,
6
6
"description" : " Edit markdown in a WYSIWYG way, powered by milkdown." ,
7
- "version" : " 0.0.6 " ,
7
+ "version" : " 0.0.7 " ,
8
8
"engines" : {
9
9
"vscode" : " ^1.59.0"
10
10
},
Original file line number Diff line number Diff line change @@ -50,7 +50,6 @@ export class MilkdownEditorProvider implements vscode.CustomTextEditorProvider {
50
50
51
51
const updateWebview = ( ) => {
52
52
const text = document . getText ( ) ;
53
- console . log ( text ) ;
54
53
if ( text === this . content ) return ;
55
54
webviewPanel . webview . postMessage ( {
56
55
type : 'update' ,
@@ -73,7 +72,6 @@ export class MilkdownEditorProvider implements vscode.CustomTextEditorProvider {
73
72
} ) ;
74
73
75
74
vscode . window . onDidChangeActiveColorTheme ( ( ) => {
76
- console . log ( '---change color scheme---' ) ;
77
75
webviewPanel . webview . postMessage ( {
78
76
type : 'restart' ,
79
77
} ) ;
@@ -86,6 +84,9 @@ export class MilkdownEditorProvider implements vscode.CustomTextEditorProvider {
86
84
this . updateDocument ( document , e . content ) ;
87
85
return ;
88
86
case 'ready' :
87
+ console . log ( '---editor is ready---' ) ;
88
+ this . clientLock = false ;
89
+ this . content = '' ;
89
90
updateWebview ( ) ;
90
91
return ;
91
92
}
Original file line number Diff line number Diff line change @@ -36,6 +36,11 @@ export const vscode = () =>
36
36
padding: 1.25rem;
37
37
box- sizing: bor der- box;
38
38
39
+ .code-fence {
40
+ background : unset;
41
+ ${ widget . border ?.( ) }
42
+ }
43
+
39
44
.editor {
40
45
outline : none;
41
46
height : 100% ;
@@ -90,11 +95,6 @@ export const vscode = () =>
90
95
${ ( _b = widget . border ) === null || _b === void 0 ? void 0 : _b . call ( widget ) }
91
96
}
92
97
93
- @media only screen and (min-width : 72rem ) {
94
- max-width : 57.375rem ;
95
- padding : 3.125rem 7.25rem ;
96
- }
97
-
98
98
& ::selection {
99
99
background : ${ palette ( 'secondary' , 0.38 ) } ;
100
100
}
Original file line number Diff line number Diff line change @@ -64,30 +64,13 @@ const createEditor = () =>
64
64
. use ( prism )
65
65
. create ( ) ;
66
66
67
- const changeTheme = ( target : Node ) => {
68
- if ( target instanceof HTMLElement ) {
69
- const isDark = target . classList . contains ( 'vscode-dark' ) ;
70
- document . body . dataset . theme = isDark ? 'dark' : 'light' ;
71
- }
72
- } ;
73
-
74
67
async function main ( ) {
75
68
let editor = await createEditor ( ) ;
76
69
77
70
vscode . postMessage ( {
78
71
type : 'ready' ,
79
72
} ) ;
80
73
81
- changeTheme ( document . body ) ;
82
-
83
- const observer = new MutationObserver ( function ( mutations ) {
84
- mutations . forEach ( ( mutationRecord ) => {
85
- changeTheme ( mutationRecord . target ) ;
86
- } ) ;
87
- } ) ;
88
-
89
- observer . observe ( document . body , { attributes : true , attributeFilter : [ 'class' ] } ) ;
90
-
91
74
const updateEditor = ( markdown : string ) => {
92
75
if ( typeof markdown !== 'string' ) return ;
93
76
editor . action ( ( ctx ) => {
@@ -108,13 +91,17 @@ async function main() {
108
91
const view = ctx . get ( editorViewCtx ) ;
109
92
view . dom . parentElement ?. remove ( ) ;
110
93
editor = await createEditor ( ) ;
94
+ vscode . postMessage ( {
95
+ type : 'ready' ,
96
+ } ) ;
111
97
} ) ;
112
98
} ;
113
99
114
100
window . addEventListener ( 'message' , ( event ) => {
115
101
const message = event . data ;
116
102
switch ( message . type ) {
117
103
case 'update' : {
104
+ console . log ( '---wtf---' ) ;
118
105
const text = message . text ;
119
106
if ( text === contentCache ) return ;
120
107
serverLock = true ;
You can’t perform that action at this time.
0 commit comments