File tree Expand file tree Collapse file tree 4 files changed +25
-0
lines changed Expand file tree Collapse file tree 4 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,10 @@ var _require2 = require('./consts'),
106106function textStyle ( layer ) {
107107 var keywords = [ ] ;
108108 var style = "" ;
109+
110+ if ( ! isEmpty ( layer . text_style ) ) {
111+ return layer . text_style ;
112+ }
109113 Object . keys ( LAYER_KEYWORD_PARAMS ) . forEach ( function ( attr ) {
110114 var default_value = LAYER_KEYWORD_PARAMS [ attr ] ;
111115 var attr_value = layer [ attr ] || default_value ;
Original file line number Diff line number Diff line change @@ -93,6 +93,10 @@ const {
9393function textStyle ( layer ) {
9494 let keywords = [ ] ;
9595 let style = "" ;
96+
97+ if ( ! isEmpty ( layer . text_style ) ) {
98+ return layer . text_style ;
99+ }
96100 Object . keys ( LAYER_KEYWORD_PARAMS ) . forEach ( ( attr ) => {
97101 let default_value = LAYER_KEYWORD_PARAMS [ attr ] ;
98102 let attr_value = layer [ attr ] || default_value ;
Original file line number Diff line number Diff line change @@ -1268,6 +1268,22 @@ describe("utils", function () {
12681268 . emptyOptions ( ) ;
12691269 } ) ;
12701270 } ) ;
1271+ it ( 'should support text layer style identifier variables' , function ( ) {
1272+ const options = {
1273+ transformation : [
1274+ {
1275+ variables : [ [ "$style" , "!Arial_12!" ] ]
1276+ } , {
1277+ overlay : {
1278+ text : "hello-world" ,
1279+ text_style : "$style"
1280+ }
1281+ }
1282+ ]
1283+ }
1284+ const url = cloudinary . utils . url ( "sample" , options ) ;
1285+ expect ( url ) . to . eql ( `http://res.cloudinary.com/${ cloud_name } /image/upload/$style_!Arial_12!/l_text:$style:hello-world/sample` ) ;
1286+ } ) ;
12711287 } ) ;
12721288 } ) ;
12731289 describe ( 'build_eager' , function ( ) {
Original file line number Diff line number Diff line change @@ -312,6 +312,7 @@ declare module 'cloudinary' {
312312 }
313313
314314 interface TextStyleOptions {
315+ text_style ?: string ;
315316 font_family ?: string ;
316317 font_size ?: number ;
317318 font_color ?: string ;
You can’t perform that action at this time.
0 commit comments